dev-master
9999999-dev
MIT
The Requires
- php >=7.0.0
- psr/log ^1.0
- illuminate/http ^5
The Development Requires
Wallogit.com
2017 © Pedro Peláez
![Build Status][travis-image] ![MIT License][license-image], (*1)
Laravel Sunset allows you to deprecate URLs (API or otherwise)., (*2)
The Sunset header is an in-development HTTP response header that is aiming to standardize how URLs are marked for deprecation. tl:dr; it looks a bit like this:, (*3)
Sunset: Sat, 31 Dec 2018 23:59:59 GMT
This can be combined with a Link: <http://foo.com/something> rel="sunset" which can be anything that might help a developer know what is going on. Maybe link to your API documentation for the new resource, the OpenAPI/JSON Schema definitions, or even a blog post explaining the change., (*4)
Via Composer, (*5)
composer require hskrasek/laravel-sunset
Within your base controller, add the following:, (*6)
<?php
namespace App\Http\Controllers;
use HSkrasek\Laravel\Sunset\SunsetsEndpoints;
class Controller {
use SunsetsEndpoints;
}
Then when returning a response from your controller, do the following:, (*7)
<?php
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
);
}
}
Please see CHANGELOG for more information on what has changed recently., (*8)
bash
$ composer test, (*9)
Bug reports and pull requests are welcome on GitHub at hskrasek/laravel-sunset. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct., (*10)
MIT