eliseekn / laravel-api-response
Send JSON response from your API.
Installs: 115
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/eliseekn/laravel-api-response
Requires
- php: ^8.1
- illuminate/http: ^10.20
Requires (Dev)
- phpunit/phpunit: ^9.0
README
Send JSON response from your API.
Installation
composer require eliseekn/laravel-api-response
Usage
Add MakeApiResponse
trait where you need to use and use it as follows :
$this->response('success', 'Lorem ipsum dolor sit amet', 201); $this->response('warning', [ 'key1' => 'value', 'key2' => 'value' ], 405); $this->successResponse('Lorem ipsum dolor sit amet'); $this->successResponse([ 'key1' => 'value', 'key2' => 'value' ]); $this->errorResponse(...);