jobilla/deprecated-routes-middleware

A Laravel middleware to mark routes/endpoints as deprecated

1.2.0 2022-05-15 13:52 UTC

This package is auto-updated.

Last update: 2024-10-10 12:56:07 UTC


README

Laravel package to provide a middleware to mark any route as deprecated.

Install

Run the following command in your project folder to add the package to your project.

composer require jobilla/deprecated-routes-middleware

(Optional) Add the following line to $routeMiddleware array in your app/Http/Kernel.php.

'deprecated' => \Jobilla\DeprecatedRoutes\Http\Middlewares\DeprecatedRoute::class,

Usage

Using the middleware on route groups

You can define the deprecation on route group level.

Route::prefix('api/v3')
    ->middleware('deprecated:2021-03-22')
    ->group(function () {
        // Your route definitions here.
    });

Using the middleware on individual routes

You can define the middleware on a single route.

Route::get('old/endpoint', OldEnpointController::class)->middleware('deprecated:2021-03-22');

Using the middleware on controllers

You can define the middleware inside a controller class.

class OldEnpointController extends Controller
{
    public function __construct()
    {
        $this->middleware('deprecated:2021-03-22');
    }
}