asifcode / api-response
Sending api response
v1.0.1
2024-05-30 21:22 UTC
Requires
- php: >=7.4
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-12-30 22:27:38 UTC
README
This is package for api response from laravel controller. you can return pagination and json data with this packages.
Installation
You can install the package via composer:
composer require asifcode/api-response
Usage
use Asifcode\ApiResponse\ApiResponse; //general api response return ApiResponse::response(200)->message('Hello World')->data()->send(); //laravel collection pagination response return ApiResponse::response(200)->message('Hello World')->data()->pagination(); //request errors response protected function failedValidation(Validator $validator) { throw new HttpResponseException( ApiResponse::response(422)->errors($validator->messages())->success(false)->send() ); }
Testing
composer test
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 asif.ice.pust@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.