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 1mo ago

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

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Every ~1 days

Total

2

Last Release

1854d 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

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[pdphilip/cf-request

Cloudflare Laravel Request

2725.6k1](/packages/pdphilip-cf-request)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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