Download the PHP package square/vermillion without Composer

On this page you can find all versions of the php package square/vermillion. 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 vermillion

Vermillion 🍂

PHP

An API versioning toolkit for Laravel applications️


What you get

Installation

Configuration

First, ensure that Square\Vermillion\VersioningServiceProvider is registered in your app. Sometimes it's automatic (via package discovery), sometimes it's not, so please double-check your app configuration.

Run this to generate a copy of the versioning config:

Choose an API version format

There are many ways versions are notated e.g. SemVer. There is built-in support for two formats you can choose from:

You can also roll your own. See "Use your own versioning format" under Advanced Usage.

Choose an API versioning scheme

You can pick a way clients can specify API versions:

Specify supported versions

You can configure min, latest, and max versions independently in the config file:

  1. Minimum version (e.g. 'min' => '1') - The oldest version your API currently supports. Any versioned routes requested with a version lesser than the min version will automatically 404.
  2. Latest version (e.g. 'latest' => '2') - The latest stable version your API supports. This will be the version used when nothing was not explicitly specified or when none can be inferred e.g. when generating URLs when not in a versioned route context, in async jobs, etc.
  3. Maximum version (e.g. 'max' => '3') - The maximum version your API supports. Anything that one would consider alpha, beta, or RC are better suited in versions that is greater latest. This the max API version clients can ask for i.e. Any versioned routes requested with a greater version than the max version will automatically 404.

Basic Usage

How to define versioned routes

Route URL generation

When using url_prefix as versioning scheme, the URL generator will be automatically configured to use the current active version.

If there is no active version e.g. code executed within an unversioned route, the latest version will be used (defined in config('versioning.latest')).

If you wish to generate a route for another API version, specify the apiVersion option:

ApiVersion service

You can specify Square\Vermillion\ApiVersion as a dependency and you will get a reference to the current active (or latest) API version object:

NOTE: You need to type-hint the Square\Vermillion\ApiVersion abstract, NOT any of concrete implementations in Square\Vermillion\Formats\* namespace!

Versioning API responses

You can use the Square\Vermillion\Traits\JsonResource\WithReverseMigrations trait to support Stripe-like data versioning via "reverse migrations":

Header-based versioning & MissingVersionException

By default, using the header scheme will require that requests have the header present when its for a versioned route. This manifests as a MissingVersionException thrown, which you will want to render appropriately:

Advanced Usage

Using your own custom versioning scheme

If you need to determine the API version to use given an HTTP request, you will need to write your own scheme by implementing Square\Vermillion\VersioningScheme contract.

Specify your custom versioning scheme's FQCN in the versioning configuration:

Using your own custom version format

  1. You can implement your own versioning format e.g. SemVer by extending the Square\Vermillion\ApiVersion abstract. All that is required for your new ApiVersion type is to provide an integer representation of your version strings. This is used by the library to compute the ordinality between versions, which is what is all that is needed for everything to work.

  2. You will need to implement a Square\Vermillion\VersionNormalizer class that is responsible for converting a version string to an instance of your custom ApiVersion sub-class. It MUST support your custom version strings as input, as well as the custom ApiVersion sub-class. It MUST throw BadVersionFormatException if it is provided an input that it cannot convert into a valid ApiVersion for according to your custom version format spec.

  3. Specify the FQCN of your normalizer as versioning.normalizer config value e.g.

Version anything using VersionedSet

A powerful way to model conditional logic is through the Strategy pattern, especially if there are many possible branches. This is often the case when supporting many API versions. The VersionedSet utility class is specifically designed to make API version-based decisions easy to implement & manage:

PHPStan

Add this line to your phpstan.neon file to fill static analysis gaps around Route methods, etc.


All versions of vermillion with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/contracts Version ^8.0|^9.0|^10.0
illuminate/routing Version ^8.0|^9.0|^10.0
illuminate/support Version ^8.0|^9.0|^10.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 square/vermillion contains the following files

Loading the files please wait ....