Skip to content

jobilla/deprecated-routes-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated Routes

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');
    }
}