Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softonic/laravel-request-accept-json-middleware
Laravel middleware to add Accept application/json header to requests
https://github.com/softonic/laravel-request-accept-json-middleware
accept json laravel laravel-middleware middleware
Last synced: about 17 hours ago
JSON representation
Laravel middleware to add Accept application/json header to requests
- Host: GitHub
- URL: https://github.com/softonic/laravel-request-accept-json-middleware
- Owner: softonic
- License: other
- Created: 2019-07-26T14:02:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-28T09:20:42.000Z (over 1 year ago)
- Last Synced: 2024-12-18T11:24:40.687Z (4 days ago)
- Topics: accept, json, laravel, laravel-middleware, middleware
- Language: PHP
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
Laravel request accept json middleware
=====[![Latest Version](https://img.shields.io/github/release/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](https://github.com/softonic/laravel-request-accept-json-middleware/releases)
[![Software License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/softonic/laravel-request-accept-json-middleware/master.svg?style=flat-square)](https://travis-ci.org/softonic/laravel-request-accept-json-middleware)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](https://scrutinizer-ci.com/g/softonic/laravel-request-accept-json-middleware/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](https://scrutinizer-ci.com/g/softonic/laravel-request-accept-json-middleware)
[![Total Downloads](https://img.shields.io/packagist/dt/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](https://packagist.org/packages/softonic/laravel-request-accept-json-middleware)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](http://isitmaintained.com/project/softonic/laravel-request-accept-json-middleware "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/softonic/laravel-request-accept-json-middleware.svg?style=flat-square)](http://isitmaintained.com/project/softonic/laravel-request-accept-json-middleware "Percentage of issues still open")This middleware adds the ability to automatically add the Accept application/json header to every request if it was not provided.
Installation
-------Via composer:
```
composer require softonic/laravel-request-accept-json-middleware
```Documentation
-------To use the middleware register it in `app/Http/Kernel.php`
```
protected $middleware
= [
...
RequestAcceptJson::class,
...
];
```From now on the header `Accept: application/json` will be automatically added to every request.
Testing
-------`softonic/laravel-request-accept-json-middleware` has a [PHPUnit](https://phpunit.de) test suite and a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/).
To run the tests, run the following command from the project folder.
``` bash
$ docker-compose run test
```License
-------The Apache 2.0 license. Please see [LICENSE](LICENSE) for more information.
[PSR-2]: http://www.php-fig.org/psr/psr-2/
[PSR-4]: http://www.php-fig.org/psr/psr-4/