Download the PHP package xurudragon/api-versioning-bundle without Composer

On this page you can find all versions of the php package xurudragon/api-versioning-bundle. 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 api-versioning-bundle

ApiVersioningBundle

Informations

Build Status - master

This bundle provide you a way to handle multiple version of your api. See Usage section to know how ise this bundle

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles If you are on Symfony 3.* look in the app/AppKernel.php file of your project:

If you are on Symfony 4.* look in the config/bundles.php file of your project:

Step 3: Configuration

Nothing special to do here. Unless you want to change the header name sent to the api to processing versioning changes You can add theses entries into your config files :

Usage

Introduction

Your API reponse must always match the latest version of your API.

To support multiple versions, you must for each version of your API that breaks the backward compatibility:

  1. create a change class inheriting from the following abstract class: XuruDragon\ApiVersioningBundle\Changes\AbstractChanges
  2. add an entry in the configuration file corresponding to the class created previously

we recommend to you the following structure:

  1. Create a folder named ApiChanges
  2. Name your classes ApiChangesXYZ, with X for the Major version, Y for the Minor version and Z for the Patch version

We assume that you know the semantic versioning system

Create the Change Class

Here is the 0.9.0 class version, which assumes that your API version is at least 0.9.1 .

You should now implement the apply and supports methods with your own logic.

supports should return true or false following if this version change support the actual data returned by your latest api version.

apply should do whatever you want to transform the actual data into an version that correspond to this api version. The returned array would be encoded in json and return to the api client that have make the request.

Example

Imagine that version 1.0.0 of your API adds an entry to the json output of one of the called services. This entry would be "location" within the following data array returned by your latest API version :

You must then delete this data entry so that the requested version 0.9.0 matches what the calling client is waiting for.

You can do that by modifying the previously created class with the following code :

Of course here it's a pretty simple example of delete One entry, the processing could be more more complicated.

Register your version changes class in the configuration

Here you are, no more configuration is required.


All versions of api-versioning-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/http-foundation Version >=2.7
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 xurudragon/api-versioning-bundle contains the following files

Loading the files please wait ....