PHPackages                             halloverden/symfony-route-deprecation-bundle - 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. halloverden/symfony-route-deprecation-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

halloverden/symfony-route-deprecation-bundle
============================================

The Route Deprecation Bundle provides tools to deprecate routes in your Symfony application. It implements the IETF draft of The Deprecation HTTP Header Field.

3.1.0(1y ago)95.6k2[1 issues](https://github.com/halloverden/symfony-route-deprecation-bundle/issues)MITPHPPHP &gt;=8.2

Since Aug 11Pushed 1y ago3 watchersCompare

[ Source](https://github.com/halloverden/symfony-route-deprecation-bundle)[ Packagist](https://packagist.org/packages/halloverden/symfony-route-deprecation-bundle)[ RSS](/packages/halloverden-symfony-route-deprecation-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (16)Used By (0)

Route Deprecation Bundle
========================

[](#route-deprecation-bundle)

The Route Deprecation Bundle provides tools to deprecate routes in your Symfony application. It implements the IETF draft of [The Deprecation HTTP Header Field](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-deprecation-header).

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require halloverden/symfony-route-deprecation-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require halloverden/symfony-route-deprecation-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    HalloVerden\RouteDeprecationBundle\HalloVerdenRouteDeprecationBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

You can deprecate any route with the `DeprecatedRoute` annotation.

- `since` (required) - is a `string ("yyyy-mm-dd")` that defines the moment in which a route becomes deprecated. The header `Deprecation` will be set on the response, like so: `Deprecation: @1672531200`.
- `sunset` (optional) - is a `string ("yyyy-mm-dd")` that defines the moment in which a route becomes expired. The header `Sunset` will be set on the response, like so: `Sunset: Mon, 01 Jun 2020 00:00:00 GMT`
- `enforce` (optional) - is a `boolean` that makes the route inaccessible after the `sunset` date (default is `false`). If you try to access a route where this option is set to `true` and the current date is greater than the `sunet` date, a `GoneHttpException` is thrown.
- `name` (optional) - The name of the route to deprecate. If not specified, all routes (on that controller) will be deprecated.
- `deprecationDateTimeFormat` (optional) - The format of the date time used in the Deprecation header. default is `@U` (as per the IETF draft).
- `sunsetDateTimeFormat` (optional) - The format of the date time used in the Sunset header. default is `D, d M Y H:i:s \G\M\T` (as per the Sunset RFC)
- `deprecationLink` (optional) - The link used in the `Link` header for deprecation.
- `sunsetLink` - (optional) - The link used in the `Link` header for sunset.

you can also deprecate any route with route parameters.

Example using the attribute:

```
