weward / laramacro
Laravel的自定义宏集合
v10.0.1
2023-12-25 04:03 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
This package is auto-updated.
Last update: 2024-09-25 05:49:44 UTC
README
Laravel的自定义宏集合
目录
安装
您可以通过composer安装此包
# for the meantime
composer require weward/laramacro:dev-master
发布服务提供者
php artisan vendor:publish --tag=laramacro-providers
您可以在 config/app.php 中注册服务提供者
'providers' => [ // ... App\Providers\LaraMacroServiceProvider::class, ]
使用
响应宏
jsonApi()
是 ->json() 响应格式的超集,可以接受Laravel Resource有效负载。
// Pass normal payload and http status return response()->jsonApi($data, 200); // Pass a Resource and hhtp status return response()->jsonApi(new UserResource($data), 200);
鸣谢
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。