Download the PHP package z4kn4fein/php-semver without Composer

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

php-semver

Build Status Latest Stable Version Total Downloads Sonar Quality Gate Sonar Coverage

Semantic Versioning library for PHP. It implements the full semantic version 2.0.0 specification and provides ability to parse, compare, and increment semantic versions along with validation against constraints.

Requirements

Version PHP Version
>=1.0, <1.2 >=5.5
>=1.2, <3.0 >=7.1
>=3.0 >=8.1

Install with Composer

Usage

The following options are supported to construct a Version:

  1. Building part by part with Version::create().

  2. Parsing from a string with Version::parse() or Version::parseOrNull().

The following information is accessible on a constructed Version object:

Strict vs. Loose Parsing

By default, the version parser considers partial versions like 1.0 and versions starting with the v prefix invalid. This behaviour can be turned off by setting the strict parameter to false.

Compare

It is possible to compare two Version objects with the following comparison methods.

Sort

Version::sort() and Version::sortString() are available to sort an array of versions.

You might want to sort in reverse order, then you can use Version::rsort() or Version::rsortString().

Version::compare() and Version::compareString() methods also can be used as callback for usort() to sort an array of versions.

Constraints

With constraints, it's possible to validate whether a version satisfies a set of rules or not. A constraint can be described as one or more conditions combined with logical OR and AND operators.

Conditions

Conditions are usually composed of a comparison operator and a version like >=1.2.0. The condition >=1.2.0 would be met by any version that greater than or equal to 1.2.0.

Supported comparison operators:

Conditions can be joined together with whitespace, representing the AND logical operator between them. The OR operator can be expressed with || or | between condition sets.

For example, the constraint >=1.2.0 <3.0.0 || >4.0.0 translates to: Only those versions are allowed that are either greater than or equal to 1.2.0 {AND} less than 3.0.0 {OR} greater than 4.0.0.

We can notice that the first part of the previous constraint (>=1.2.0 <3.0.0) is a simple semantic version range. There are more ways to express version ranges; the following section will go through all the available options.

Range Conditions

There are particular range indicators which are sugars for more extended range expressions.

Validation

Let's see how we can determine whether a version satisfies a constraint or not.

Increment

Version objects can produce incremented versions of themselves with the getNext{Major|Minor|Patch|PreRelease}Version methods. These methods can be used to determine the next version in order incremented by the according part. Version objects are immutable, so each incrementing function creates a new Version.

This example shows how the incrementation works on a stable version:

In case of an unstable version:

Each incrementing function provides the option to set a pre-release identity on the incremented version.

Copy

It's possible to make a copy of a particular version with the copy() method. It allows altering the copied version's properties with optional parameters.

[!NOTE]\ Without setting any optional parameter, the copy() method will produce an exact copy of the original version.

Invalid version handling

When the version or constraint parsing fails due to an invalid format, the library throws a specific SemverException.

[!NOTE]\ The Version::parseOrNull() and Constraint::parseOrNull() methods can be used for exception-less conversions as they return null when the parsing fails.

Contact & Support


All versions of php-semver with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 z4kn4fein/php-semver contains the following files

Loading the files please wait ....