Download the PHP package ejunker/laravel-api-evolution without Composer

On this page you can find all versions of the php package ejunker/laravel-api-evolution. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-evolution

Evolve your API while maintaining backwards compatibility.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel API Evolution is an API versioning library based on the idea of API evolution. It provides a way to make changes to your API way while maintaining backwards compatibility.

Inspired by Stripe's API versioning strategy. Users specify the desired version in a header and the request and response data will be modified to match the requested version.

Installation

You can install the package via composer:

You can run the installation command with:

The api-evolution:install command will create the config/api-evolution.php config file.

You will need to add the middleware to your api middleware group in app/Http/Kernel.php or to the group/route that you want.

Usage

You can create an API migration using the command:

This will create the file app/Http/Migrations/FirstLastName.php that you can edit to make the necessary changes to the request and/or response. Then you need to add it to the config/api-evolution.php file so that it runs when an old version is requested. The migrations listed for a version are the migrations needed to make it match the previous version.

API Migrations

Each API migration file has several properties and methods that you can use:

In addition to routeNames and isApplicable(), you can also specify the route names for a migration in the config file.

Binds

While API Migrations allow you to modify the Request and Response, sometimes it may be easier to use an entirely different FormRequest, JsonResource, or response Transformer. In those cases you can use a Bind to bind a different version into the container.

In the config/api-evolution.php

In this example, if the user requested the 2022-10-05 version it would apply the Bind which would bind the old version of the file into the container so that it would be used. If the user requested the latest version 2022-10-10 then the Bind would not run and the latest version of the file would be used.

Determine if a Migration Is Active

If you need to modify things other than Request/Response such as modifying a SQL query based on the version then you can use ApiEvolution::isActive(). For example, to know if the FirstLastName migration is active: ApiEvolution::isActive(FirstLastName::class)

Response Headers

Several headers are added to the response:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

This package is based on the following:

License

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


All versions of laravel-api-evolution with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.13.0
illuminate/contracts Version ^9.0 || ^10.0 || ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ejunker/laravel-api-evolution contains the following files

Loading the files please wait ....