andrey-helldar/laravel-json-response

This package is abandoned and no longer maintained. The author suggests using the dragon-code/laravel-json-response package instead.

Automatically always return a response in JSON format

v1.0.1 2021-06-07 16:10 UTC

This package is auto-updated.

Last update: 2021-11-16 20:35:55 UTC


README

Laravel Json Response

Stable Version Unstable Version Total Downloads Github Workflow Status License

Automatically always return a response in JSON format

Installation

To get the latest version of Laravel Json Response, simply require the project using Composer:

$ composer require dragon-code/laravel-json-response

Or manually update require block of composer.json and run composer update.

{
    "require": {
        "dragon-code/laravel-json-response": "^1.0"
    }
}

Upgrade from andrey-helldar/laravel-json-response

  1. Replace "andrey-helldar/laravel-json-response": "^1.0" with "dragon-code/laravel-json-response": "^2.0" in the composer.json file;
  2. Call the composer update console command.

Using

After you've installed the package via composer, you're done. There's no step two.

This package will automatically register the DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware middleware in the web and api groups, if they exist. The middleware will add a header Accept that will effectively convert all responses to JSON format. This header will apply to all responses.