PHPackages                             heypongo/laravel-deprecation-middleware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. heypongo/laravel-deprecation-middleware

ActiveLibrary[HTTP &amp; Networking](/categories/http)

heypongo/laravel-deprecation-middleware
=======================================

A Laravel middleware to signal HTTP route deprecation (Deprecation, Sunset, Link headers)

1.0.0(11mo ago)72MITPHPPHP &gt;=8.1CI passing

Since Jul 11Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/heypongo/laravel-deprecation-middleware)[ Packagist](https://packagist.org/packages/heypongo/laravel-deprecation-middleware)[ RSS](/packages/heypongo-laravel-deprecation-middleware/feed)WikiDiscussions dev Synced today

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Laravel Deprecation Middleware
==============================

[](#laravel-deprecation-middleware)

A Laravel middleware to signal HTTP route deprecation using standardized HTTP headers ([Deprecation RFC 8594](https://www.rfc-editor.org/rfc/rfc8594), [Sunset RFC 8594](https://datatracker.ietf.org/doc/html/rfc8594), [Link RFC 8288](https://www.rfc-editor.org/rfc/rfc8288)).

Features
--------

[](#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
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10 or 11

Installation
------------

[](#installation)

```
composer require heypongo/laravel-deprecation-middleware
```

The service provider is auto-discovered by Laravel. No manual registration is required.

Usage
-----

[](#usage)

Apply the middleware to your routes in `routes/web.php` or `routes/api.php`:

```
Route::get('/old-endpoint', function () {
    // ...
})->middleware('deprecated');
```

### With Parameters

[](#with-parameters)

You can specify deprecation date, documentation URL, and sunset date:

```
// Only deprecation date
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z');

// Deprecation date and documentation URL
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z,https://docs.example.com/deprecation');

// Deprecation date, documentation URL, and sunset date
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z,https://docs.example.com/deprecation,2024-12-01T00:00:00Z');

// Only documentation URL and sunset date
Route::get('/old', fn() => ...)->middleware('deprecated,,https://docs.example.com/deprecation,2024-12-01T00:00:00Z');
```

#### Parameter Order

[](#parameter-order)

1. Deprecation date (HTTP-date or timestamp, optional)
2. Documentation URL (optional)
3. Sunset date (HTTP-date, optional)

### Example Response Headers

[](#example-response-headers)

```
Deprecation: Wed, 01 Jun 2024 00:00:00 GMT
Link: ; rel="deprecation"; type="text/html"
Sunset: Sun, 01 Dec 2024 00:00:00 GMT

```

Logging
-------

[](#logging)

- If the sunset date is invalid or before the deprecation date, a warning is logged using Laravel's logger.

Testing
-------

[](#testing)

You are encouraged to add tests using PHPUnit and Laravel's testing tools.

Running Tests
-------------

[](#running-tests)

Install dev dependencies:

```
composer install
```

Run the tests:

```
vendor/bin/phpunit
```

License
-------

[](#license)

MIT License. See [LICENCE](LICENCE).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance50

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

359d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9abee4c9fe8d7c2aa002c2ce6f48fe1f17364a24ef68ecfa854c6827bb5c0be7?d=identicon)[beckfrederic](/maintainers/beckfrederic)

---

Top Contributors

[![beckfrederic](https://avatars.githubusercontent.com/u/116568711?v=4)](https://github.com/beckfrederic "beckfrederic (1 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/heypongo-laravel-deprecation-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/heypongo-laravel-deprecation-middleware/health.svg)](https://phpackages.com/packages/heypongo-laravel-deprecation-middleware)
```

###  Alternatives

[mateusjunges/laravel-kafka

A kafka driver for laravel

7253.6M21](/packages/mateusjunges-laravel-kafka)[illuminate/http

The Illuminate Http package.

11937.9M7.0k](/packages/illuminate-http)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
