dev-master
9999999-dev https://github.com/klopal/laravel-api-versionsImplement date based versioning to Laravel Form Request and Resources for your API
MIT
The Requires
- php ^7.1
The Development Requires
api klopal laravel-api-changes
Implement date based versioning to Laravel Form Request and Resources for your API
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', ], ];
Publish the config-file with: ``` bash php artisan vendor:publish --provider="Klopal\ApiVersions\ApiVersionsServiceProvider" --tag="config", (*6)
### Usage ... ### Testing ``` bash composer test
Please see CHANGELOG for more information what has changed recently., (*7)
If you discover any security related issues, please email kalle@klopal.com instead of using the issue tracker., (*8)
The MIT License (MIT). Please see License File for more information., (*9)
Implement date based versioning to Laravel Form Request and Resources for your API
MIT
api klopal laravel-api-changes