witify/laravel-json-response is a Laravel package for quickly make json responses in laravel.
It currently has 1 GitHub stars and 5.482 downloads on Packagist (latest version 1.2.0).
Install it with composer require witify/laravel-json-response.
Discover more Laravel packages by witify
or browse all Laravel packages to compare alternatives.
Last updated
You can install the package via composer:
composer require witify/laravel-json-response
Add it to your controller:
use Witify\LaravelJsonReponse\JsonTrait;
class ApiController extends Controller {
use JsonTrait;
}
| Method | Description | | --- | --- | | setStatusCode(int $statusCode) | Set the status code of the response | | getStatusCode(int $statusCode) | Get the status code of the response | | response($data, $headers = []) | Create a json response | | success($message = "", $data = null) | Create a successful json response | | error($message = "", $data = null) | Create a failed json response |
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.