PHPackages                             wizofgoz/deprecation-laravel - 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. wizofgoz/deprecation-laravel

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

wizofgoz/deprecation-laravel
============================

Allows for marking URLs as deprecated via HTTP response headers

v1.1.0(5y ago)14[1 issues](https://github.com/Wizofgoz/deprecation-laravel/issues)MITPHPPHP ^8.0

Since Apr 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Wizofgoz/deprecation-laravel)[ Packagist](https://packagist.org/packages/wizofgoz/deprecation-laravel)[ Docs](https://github.com/wizofgoz/deprecation-laravel)[ GitHub Sponsors](https://github.com/Wizofgoz)[ RSS](/packages/wizofgoz-deprecation-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

Mark URLs as deprecated via HTTP response headers
=================================================

[](#mark-urls-as-deprecated-via-http-response-headers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a2aa1f3c1e5f8f0437eaf26160cdd7743e7fb350afb07cc5a60fac08803e60f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77697a6f66676f7a2f6465707265636174696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wizofgoz/deprecation-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a5e1726c6834ae06624837c1017412a74fde525f015d82bc5bb5002c1b219ac7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f77697a6f66676f7a2f6465707265636174696f6e2d6c61726176656c2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/wizofgoz/deprecation-laravel/actions?query=workflow%3Arun-tests+branch%3Amaster)[![codecov](https://camo.githubusercontent.com/f8b577574fa90d066e98f04064321991e4f376234b186b3431acdc055b1a2665/68747470733a2f2f636f6465636f762e696f2f67682f57697a6f66676f7a2f6465707265636174696f6e2d6c61726176656c2f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d44524447313130555949)](https://codecov.io/gh/Wizofgoz/deprecation-laravel)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c9aa792c0a083242427c37d8c83e8741fc7f01960ceeea85e0f38ea3c9921b07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f77697a6f66676f7a2f6465707265636174696f6e2d6c61726176656c2f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/wizofgoz/deprecation-laravel/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/96b682c71d7d68a881b7ba2a95c65d0ea96d514ed7ecce0216dc7256c161c1cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77697a6f66676f7a2f6465707265636174696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wizofgoz/deprecation-laravel)

This package can be installed in a Laravel application to mark API endpoints as deprecated according to the [Deprecation HTTP Header Field](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html) draft.

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

[](#installation)

You can install the package via composer:

```
composer require wizofgoz/deprecation-laravel
```

Usage
-----

[](#usage)

Apply the middleware everywhere you want to be able to send deprecation headers, most likely the global middleware stack in the HTTP kernel.

```
protected $middleware = [
    \Wizofgoz\DeprecationLaravel\Http\Middleware\DeprecationAwareMiddleware::class,
];
```

During the course of the request life cycle, the resource that is being served can be marked as deprecated by using the facade, and the middleware will attach the appropriate headers to the response.

```
use \Wizofgoz\DeprecationLaravel\Deprecated;
use \Wizofgoz\DeprecationLaravel\Facades\Deprecation;
use \Wizofgoz\DeprecationLaravel\Links\AlternateLink;
use \Wizofgoz\DeprecationLaravel\Links\LatestLink;
use \Wizofgoz\DeprecationLaravel\Links\SuccessorLink;

// The resource is simply deprecated
$deprecated = Deprecated::new();

// The resource will be deprecated at a certain date
$deprecated = Deprecated::new()->setDate(new Carbon());

// Add a link to an alternate resource that could be used
$deprecated->addLink(new AlternateLink('https://example.com/resource'));

// Add a link to the resource that is the successor of this one
$deprecated->addLink(new SuccessorLink('https://example.com/resource'));

// Add a link to the resource that is the latest version of this one
$deprecated->addLink(new LatestLink('https://example.com/resource'));

// Apply the deprecation setting to the container so the middleware can pick it up
Deprecation::deprecate($deprecated);

// Unset a deprecation that has been set already
Deprecation::deprecate(null);
```

To convey that a resource will stop receiving requests in the future, they can be marked as sunsetted.

```
use \Wizofgoz\DeprecationLaravel\Sunset;
use \Wizofgoz\DeprecationLaravel\Facades\Deprecation;

$sunset = Sunset::new(new Carbon());

Deprecation::sunset($sunset);

// Unset a sunset that has been set already
Deprecation::sunset(null);
```

### Events

[](#events)

Events are emitted when the middleware applies the `Deprecation` and `Sunset` headers. Simply, register listeners for either the `DeprecatedResourceCalled` or `SunsettedResourceCalled` events.

```
Event::listen(function (DeprecatedResourceCalled $event) {
    Log::warning('Call to deprecated resource: ' . $event->request->getUri());
});
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Wizofgoz](https://github.com/Wizofgoz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1 days

Total

2

Last Release

1907d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8a59805c1199f66a3a25c99de161397fd4e4d293753216ef1c872b2db169d1b?d=identicon)[Wizofgoz](/maintainers/Wizofgoz)

---

Top Contributors

[![Wizofgoz](https://avatars.githubusercontent.com/u/10892542?v=4)](https://github.com/Wizofgoz "Wizofgoz (12 commits)")

---

Tags

laravelWizofgozdeprecation-laravel

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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