PHP code example of hskrasek / laravel-sunset

1. Go to this page and download the library: Download hskrasek/laravel-sunset 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/ */

    

hskrasek / laravel-sunset example snippets




namespace App\Http\Controllers;

use HSkrasek\Laravel\Sunset\SunsetsEndpoints;

class Controller {
    use SunsetsEndpoints;
}



namespace App\Http\Controllers;

use HSkrasek\Laravel\Sunset\SunsetsEndpoints;

class APIController extends Controller {
    public function index()
    {
        // Other logic here
        return $this->sunsetsResponse(
            response()->json(['foo' => 'bar',]),
            '2017-12-31 23:59:59', // When this endpoint is being deprecated
            'http://example.com' // Optional link explaining the deprecation
        );
    }
}