cubedtear/semver

Semantic versioning string parsing and comparison library.

v1.1.0 2022-11-28 00:45 UTC

This package is auto-updated.

Last update: 2024-09-28 04:50:51 UTC


README

Simple PHP library to parse and compare Semantic Versioning versions.

Installation

Install the latest version with:

$ composer require cubedtear/semver

Requirements

  • PHP 8.1 is required but using the latest version of PHP is highly recommended.

Basic usage

use Cubedtear\Semver\Version;

$v1 = Version::parse("0.1.1");
$v2 = Version::parse("0.1.1-alpha");
$v3 = Version::parse("1.0.12-beta+ff12b4d8");

if (Version::compare($v1, $v2)) {
    ...
}

if (Version::compare("0.1.1", "0.1.0")) {
    ...
}