PHP code example of heypongo / laravel-deprecation-middleware

1. Go to this page and download the library: Download heypongo/laravel-deprecation-middleware library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heypongo / laravel-deprecation-middleware example snippets


Route::get('/old-endpoint', function () {
    // ...
})->middleware('deprecated');

// Only deprecation date
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z');

// Deprecation date and documentation URL
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z,https://docs.example.com/deprecation');

// Deprecation date, documentation URL, and sunset date
Route::get('/old', fn() => ...)->middleware('deprecated:2024-06-01T00:00:00Z,https://docs.example.com/deprecation,2024-12-01T00:00:00Z');

// Only documentation URL and sunset date
Route::get('/old', fn() => ...)->middleware('deprecated,,https://docs.example.com/deprecation,2024-12-01T00:00:00Z');

Deprecation: Wed, 01 Jun 2024 00:00:00 GMT
Link: <https://docs.example.com/deprecation>; rel="deprecation"; type="text/html"
Sunset: Sun, 01 Dec 2024 00:00:00 GMT