witify/laravel-json-response

Quickly make JSON responses in Laravel
5,500 1
Install
composer require witify/laravel-json-response
Latest Version:1.2.0
PHP:^7.1|^8.0
Laravel:4 – 8
License:MIT
Last Updated:Jun 16, 2021
Links: GitHub  ·  Packagist
Maintainer: francoislevesque

Quick JSON reponses in Laravel

Latest Version on Packagist Build Status Maintainability Test Coverage Total Downloads

Installation

You can install the package via composer:

composer require witify/laravel-json-response

Usage

Add it to your controller:


use Witify\LaravelJsonReponse\JsonTrait;

class ApiController extends Controller {
    use JsonTrait;
}

Available methods

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

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 info@witify.io instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
1.2.0 ^7.1|^8.0 * MIT
1.1.6 ^7.1 * MIT
1.1.5 ^7.1 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.* MIT
1.1.4 ^7.1 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.* MIT
1.1.3 ^7.1 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.* MIT