PHP code example of wizofgoz / deprecation-laravel
1. Go to this page and download the library: Download wizofgoz/deprecation-laravel 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/ */
use \Wizofgoz\DeprecationLaravel\Deprecated;
use \Wizofgoz\DeprecationLaravel\Facades\Deprecation;
use \Wizofgoz\DeprecationLaravel\Links\AlternateLink;
use \Wizofgoz\DeprecationLaravel\Links\LatestLink;
use \Wizofgoz\DeprecationLaravel\Links\SuccessorLink;
// The resource is simply deprecated
$deprecated = Deprecated::new();
// The resource will be deprecated at a certain date
$deprecated = Deprecated::new()->setDate(new Carbon());
// Add a link to an alternate resource that could be used
$deprecated->addLink(new AlternateLink('https://example.com/resource'));
// Add a link to the resource that is the successor of this one
$deprecated->addLink(new SuccessorLink('https://example.com/resource'));
// Add a link to the resource that is the latest version of this one
$deprecated->addLink(new LatestLink('https://example.com/resource'));
// Apply the deprecation setting to the container so the middleware can pick it up
Deprecation::deprecate($deprecated);
// Unset a deprecation that has been set already
Deprecation::deprecate(null);
use \Wizofgoz\DeprecationLaravel\Sunset;
use \Wizofgoz\DeprecationLaravel\Facades\Deprecation;
$sunset = Sunset::new(new Carbon());
Deprecation::sunset($sunset);
// Unset a sunset that has been set already
Deprecation::sunset(null);