witify/laravel-json-response

Quickly make JSON responses in Laravel
5,484 1
Install
composer require witify/laravel-json-response
Latest Version:1.2.0
PHP:^7.1|^8.0
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

reliese/laravel

Reliese Components for Laravel Framework code generation.

3,991,690 1,705
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,315 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

368,693 86
laravel/laravel

The skeleton application for the Laravel framework.

64,930,508 84,972