2017 © Pedro Peláez
 

library laravel-api-versions

Implement date based versioning to Laravel Form Request and Resources for your API

image

palokankare/laravel-api-versions

Implement date based versioning to Laravel Form Request and Resources for your API

  • Friday, June 8, 2018
  • by palokankare
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple date based versioning to Laravel API Form Requests and Rerouces

THIS PACKAGE IS STILL IN DEVELOPMENT, (*1)

This Laravel package is a proof of concept and inspired of Stripe's blog post about API versioning, (*2)

Rather than having large major API versions (v1, v2, v3...) the updates are small and named with the date they are released. This package tries to solve issue when it comes breaking change in Laravel From Requests (for example validation rules) and Laravel Resources., (*3)

API resources are written so that the structure they describe is what we’d expect back from the current version of the API. When we need to make a backwards-incompatible change we release new date based API version that will describe how to revert the change., (*4)

Example of how versions and changes are described., (*5)

return [
                '2018-06-05' => [], // Latest version doesn't have any changes naturally. Doesn't have to be defined here.
                '2018-05-28' => [
                    'App\Http\Resources\BookResource' => 'App\Http\Resources\Changes\UpdatePublishedDate',
                    'App\Http\Requests\StoreBook'     => 'App\Http\Requests\Changes\\MakeAuthorNonMandatory',
                ],
                '2018-05-26' => [
                    'App\Http\Resources\BookResource' => 'App\Http\Resources\Changes\AddAuthor',
                    'App\Http\Resources\FooResource'  => 'App\Http\Resources\Changes\Bar',
                ],
        ];

Installation

Publish the config-file with: ``` bash php artisan vendor:publish --provider="Klopal\ApiVersions\ApiVersionsServiceProvider" --tag="config", (*6)


### Usage ... ### Testing ``` bash composer test

Changelog

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

Security

If you discover any security related issues, please email kalle@klopal.com instead of using the issue tracker., (*8)

Credits

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

08/06 2018

dev-master

9999999-dev https://github.com/klopal/laravel-api-versions

Implement date based versioning to Laravel Form Request and Resources for your API

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

api klopal laravel-api-changes