novaday-co / laravel-api-response
This Package helps developers to easily make response for API
dev-master
2021-08-03 04:18 UTC
Requires
- illuminate/http: ~5.0|~6.0|~7.0|~8.0
- illuminate/support: ^8.0|^7.0|^6.0|^5.5
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-10-29 06:12:50 UTC
README
Laravel API Response
This Package helps developers to easily make response for API . Add extra data to collection response . Short magic method that use your translate files to set messages .
How to install :
composer require novaday-co/laravel-api-response
How to use :
Success response
Api::success("Successful Action")->response();
Success response
Api::success("Successful Action")->response();
Failure response
Api::failure("Failed")->response();
Custom response
Api::customResponse(201,'Created Successfully',['key'=>'value'])->response();
With data
Api::success('Ok',['key'=>'value'])->response();
External data in data
Api::success('Ok',[ User::all() ])->withData([ Customer::first() ])->response();
External data next to data
Api::success('Ok',[ User::all() ])->with([ 'Customers' => Customer::all() ])->response();
Short magic method for set messages
Api::updated()->response();