eliseekn / laravel-api-response
Send JSON response from your API.
v0.0.4
2024-03-05 05:39 UTC
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(...);