New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

open-cetacean/laravel-json-header

Middleware to force Laravel API group to JSON header
757
Install
composer require open-cetacean/laravel-json-header
Latest Version:v1.0
PHP:>=5.6.4
License:MIT
Last Updated:Jan 26, 2017
Links: GitHub  ·  Packagist
Maintainer: open-cetacean

open-cetacean/laravel-json-header is a PHP package built for Laravel to force Laravel API group to JSON header activating wantsJson()

Installation

This project can be installed via Composer. Add the following line to the require block of your composer.json file:

{
    "require": {
            "open-cetacean/laravel-json-header": "^1.0"
    }

}

You'll then run composer install or composer update.

Or run the following command:

composer require open-cetacean/laravel-json-header

Middleware

To register the middleware add the following to the $routeMiddleware array within the app/Http/Kernel.php file:

protected $routeMiddleware = [
    // ...
    'acceptJson' => \OpenCetacean\JsonHeader\Middleware\AcceptJson::class,
    // ...
];

then add the middleware to your API routes:

Route::group(['middleware' => ['api', 'acceptJson']], function () {
    // ...
}

License

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

Related Packages

softonic/laravel-request-accept-json-middleware

Laravel middleware to add Accept application/json header to requests

58,416 4
json-mapper/laravel-package

The JsonMapper package for Laravel

245,874 25
lanin/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

107,043 40
dmavrin/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

60 0
elsayed85/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

27 0

Version History

Version Released PHP License
v1.0 >=5.6.4 MIT