creativeorange / laravel-served-by
Automatically set the Served By for requests in your Laravel Framework.
Installs: 7 686
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 1
Open Issues: 0
Requires
- php: ^8.0.2
- illuminate/support: ^9|^10|^11
This package is auto-updated.
Last update: 2024-12-19 09:40:34 UTC
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.
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.