5353| 7.* | 7.* | ^3.0 | ^2.0 |
5454| 8.* | 8.* | ^4.0 | ^3.0 |
5555| 9.* - 10.* | 9.* - 10.* | ^5.0 | ^3.0 |
56+ | 11.* | 不支持 | ^6.0 | ^3.0 |
5657
5758
5859``` shell
@@ -80,6 +81,11 @@ composer require jiannei/laravel-enum "^3.0" -vvv # 可选
8081
8182composer require jiannei/laravel-response " ^5.0" -vvv
8283composer require jiannei/laravel-enum " ^3.0" -vvv # 可选
84+
85+ # laravel 11.x
86+
87+ composer require jiannei/laravel-response " ^6.0" -vvv
88+ composer require jiannei/laravel-enum " ^3.0" -vvv # 可选
8389```
8490
8591## 配置
@@ -92,7 +98,7 @@ composer require jiannei/laravel-enum "^3.0" -vvv # 可选
9298$ php artisan vendor:publish --provider=" Jiannei\Response\Laravel\Providers\LaravelServiceProvider"
9399```
94100
95- - 格式化异常响应
101+ - 格式化异常响应(laravel 11 可省略这一步)
96102
97103
98104``` php
@@ -354,7 +360,7 @@ Response::noContent();
354360``` php
355361public function fail()
356362{
357- Response::fail();// 不需要加 return
363+ return Response::fail();
358364}
359365```
360366
@@ -387,7 +393,7 @@ public function fail()
387393``` php
388394public function fail()
389395{
390- Response::fail('error');// 不需要加 return
396+ return Response::fail('error');
391397}
392398```
393399
@@ -408,7 +414,7 @@ public function fail()
408414``` php
409415public function fail()
410416{
411- Response::fail('',ResponseCodeEnum::SERVICE_LOGIN_ERROR);
417+ return Response::fail('',ResponseCodeEnum::SERVICE_LOGIN_ERROR);
412418}
413419```
414420
@@ -599,27 +605,6 @@ return [
599605
600606[ ![ ] ( https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg )] ( https://www.jetbrains.com/?from=https://github.com/jiannei )
601607
602- ## Contributors ✨
603-
604- Thanks goes to these wonderful people ([ emoji key] ( https://allcontributors.org/docs/en/emoji-key ) ):
605-
606- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
607- <!-- prettier-ignore-start -->
608- <!-- markdownlint-disable -->
609- <table >
610- <tr >
611- <td align="center"><a href="https://github.com/vanthao03596"><img src="https://avatars.githubusercontent.com/u/34786441?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pham Thao</b></sub></a><br /><a href="#design-vanthao03596" title="Design">🎨</a></td>
612- <td align="center"><a href="https://www.guanguans.cn"><img src="https://avatars.githubusercontent.com/u/22309277?v=4?s=100" width="100px;" alt=""/><br /><sub><b>guanguans</b></sub></a><br /><a href="https://github.com/jiannei/laravel-response/issues?q=author%3Aguanguans" title="Bug reports">🐛</a></td>
613- </tr >
614- </table >
615-
616- <!-- markdownlint-restore -->
617- <!-- prettier-ignore-end -->
618-
619- <!-- ALL-CONTRIBUTORS-LIST:END -->
620-
621- This project follows the [ all-contributors] ( https://github.com/all-contributors/all-contributors ) specification. Contributions of any kind welcome!
622-
623608## Stargazers over time
624609
625610[ ![ Stargazers over time] ( https://starchart.cc/jiannei/laravel-response.svg )] ( https://starchart.cc/jiannei/laravel-response )
0 commit comments