Laravel package to provide a middleware to mark any route as deprecated.
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,
You can define the deprecation on route group level.
Route::prefix('api/v3')
->middleware('deprecated:2021-03-22')
->group(function () {
// Your route definitions here.
});
You can define the middleware on a single route.
Route::get('old/endpoint', OldEnpointController::class)->middleware('deprecated:2021-03-22');
You can define the middleware inside a controller class.
class OldEnpointController extends Controller
{
public function __construct()
{
$this->middleware('deprecated:2021-03-22');
}
}