andreishevchuk / header-accept-json
中间件,用于为Laravel设置全局接受头为application/json。
v1.0
2020-10-25 19:41 UTC
Requires
- php: >=7.2
- illuminate/http: ^5.8 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-26 04:00:55 UTC
README
中间件,用于为Laravel设置全局接受头为application/json。
安装
Composer命令
composer require andreishevchuk/header-accept-json
添加到config/app.php配置文件中
'providers' => [ ..., \Andreishevchuk\HeaderAcceptJson\HeaderAcceptJsonServiceProvider::class, ... ];
Artisan命令
php artisan vendor:publish --provider="Andreishevchuk\HeaderAcceptJson\HeaderAcceptJsonServiceProvider" --tag="middleware"
添加到app/Http/Karnel.php文件中
protected $middleware = [ ..., \App\Http\Middleware\HeaderAcceptJson::class, ... ];