jobilla / deprecated-routes-middleware
A Laravel middleware to mark routes/endpoints as deprecated
Installs: 4 822
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 9
Forks: 4
Open Issues: 0
Requires
- php: ^7.4|^8.0
- laravel/framework: ^6.0|^7.0|^8.0|^9.0
- nesbot/carbon: ^2.0
Requires (Dev)
- orchestra/testbench: ^6.18|^7.0
- phpunit/phpunit: 9.5.x-dev
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'); } }