2017 © Pedro Peláez
 

library laravel-sunset

image

hskrasek/laravel-sunset

  • Thursday, November 9, 2017
  • by hskrasek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Sunset

![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)

Install

Via Composer, (*5)

composer require hskrasek/laravel-sunset

Usage

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
        );
    }
}

Change log

Please see CHANGELOG for more information on what has changed recently., (*8)

Testing

bash $ composer test, (*9)

Contributing

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)

The Versions

09/11 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

09/11 2017

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires