creativeorange/laravel-served-by
最新稳定版本:v12.0.0
Composer 安装命令:
composer require creativeorange/laravel-served-by
包简介
Automatically set the Served By for requests in your Laravel Framework.
README 文档
README
Useful middleware for Laravel Requests & Jobs to determine which server is serving (or running) the request. For HTTP requests, the identifier string will be sent back as HTTP Header "X-Served-By". In jobs, it is possible to send Context to Flare, or tag the server in Horizon.
Installation
You can install the package via composer:
composer require creativeorange/laravel-served-by
For Laravel 8 or lower please install version 1.
Requirements
- PHP 8.2+
- Laravel 9, 10, 11, or 12
Usage HTTP requests
To allow Served By for all your routes, add the ServedBy middleware at the top of the $middleware property of app/Http/Kernel.php class:
protected $middleware = [ \Creativeorange\ServedBy\Http\Middleware\ServedBy::class, // ... ];
Flare
If you use Flare, you can add the following to your job(s):
/** * Get the middleware the job should pass through. * * @return array */ public function middleware() { return [new Creativeorange\ServedBy\Http\Middleware\Jobs\ServedBy]; }
Configuration
The defaults are set in config/served-by.php. Publish the config to copy the file to your own config:
php artisan vendor:publish --tag="served-by"
By default, you can also overwrite the identifier string by adding SERVED_BY_IDENTIFIER to your .env
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-06