53
53
| 7.* | 7.* | ^3.0 | ^2.0 |
54
54
| 8.* | 8.* | ^4.0 | ^3.0 |
55
55
| 9.* - 10.* | 9.* - 10.* | ^5.0 | ^3.0 |
56
+ | 11.* | 不支持 | ^6.0 | ^3.0 |
56
57
57
58
58
59
``` shell
@@ -80,6 +81,11 @@ composer require jiannei/laravel-enum "^3.0" -vvv # 可选
80
81
81
82
composer require jiannei/laravel-response " ^5.0" -vvv
82
83
composer 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 # 可选
83
89
```
84
90
85
91
## 配置
@@ -92,7 +98,7 @@ composer require jiannei/laravel-enum "^3.0" -vvv # 可选
92
98
$ php artisan vendor:publish --provider=" Jiannei\Response\Laravel\Providers\LaravelServiceProvider"
93
99
```
94
100
95
- - 格式化异常响应
101
+ - 格式化异常响应(laravel 11 可省略这一步)
96
102
97
103
98
104
``` php
@@ -354,7 +360,7 @@ Response::noContent();
354
360
``` php
355
361
public function fail()
356
362
{
357
- Response::fail();// 不需要加 return
363
+ return Response::fail();
358
364
}
359
365
```
360
366
@@ -387,7 +393,7 @@ public function fail()
387
393
``` php
388
394
public function fail()
389
395
{
390
- Response::fail('error');// 不需要加 return
396
+ return Response::fail('error');
391
397
}
392
398
```
393
399
@@ -408,7 +414,7 @@ public function fail()
408
414
``` php
409
415
public function fail()
410
416
{
411
- Response::fail('',ResponseCodeEnum::SERVICE_LOGIN_ERROR);
417
+ return Response::fail('',ResponseCodeEnum::SERVICE_LOGIN_ERROR);
412
418
}
413
419
```
414
420
@@ -599,27 +605,6 @@ return [
599
605
600
606
[ ![ ] ( https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg )] ( https://www.jetbrains.com/?from=https://github.com/jiannei )
601
607
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
-
623
608
## Stargazers over time
624
609
625
610
[ ![ Stargazers over time] ( https://starchart.cc/jiannei/laravel-response.svg )] ( https://starchart.cc/jiannei/laravel-response )
0 commit comments