slps970093 / laravel-api-response
laravel-api-response
1.0.2
2023-10-25 13:18 UTC
Requires
- php: ^8.0
- laravel/framework: >=9.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-25 15:36:08 UTC
README
標準化API正確與錯誤的輸出套件
Installation
You can install the package via composer:
composer require slps970093/laravel-api-response
Usage
Controller 中回傳完成與失敗
<?php use Slps970093\LaravelApiResponse\Traits\HasResponse; class Demo { use HasResponse; public function index() { return $this->ok([]); } }
Controller 中拋出異常
<?php use Slps970093\LaravelApiResponse\Exceptions\ApiException; class Demo { public function index() { throw new ApiException("aaa"); } }
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email slps970093@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate by Beyond Code.