Download the PHP package heypongo/laravel-deprecation-middleware without Composer
On this page you can find all versions of the php package heypongo/laravel-deprecation-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download heypongo/laravel-deprecation-middleware
More information about heypongo/laravel-deprecation-middleware
Files in heypongo/laravel-deprecation-middleware
Package laravel-deprecation-middleware
Short Description A Laravel middleware to signal HTTP route deprecation (Deprecation, Sunset, Link headers)
License MIT
Informations about the package laravel-deprecation-middleware
Laravel Deprecation Middleware
A Laravel middleware to signal HTTP route deprecation using standardized HTTP headers (Deprecation RFC 8594, Sunset RFC 8594, Link RFC 8288).
Features
- Adds
Deprecation
header to deprecated routes - Optionally adds
Link
header with documentation URL - Optionally adds
Sunset
header for planned removal - Follows HTTP standards for deprecation signaling
Requirements
- PHP 8.1 or higher
- Laravel 10 or 11
Installation
The service provider is auto-discovered by Laravel. No manual registration is required.
Usage
Apply the middleware to your routes in routes/web.php
or routes/api.php
:
With Parameters
You can specify deprecation date, documentation URL, and sunset date:
Parameter Order
- Deprecation date (HTTP-date or timestamp, optional)
- Documentation URL (optional)
- Sunset date (HTTP-date, optional)
Example Response Headers
Logging
- If the sunset date is invalid or before the deprecation date, a warning is logged using Laravel's logger.
Testing
You are encouraged to add tests using PHPUnit and Laravel's testing tools.
Running Tests
Install dev dependencies:
Run the tests:
License
MIT License. See LICENCE.