arkuuu/semantic-version

A small tool to handle semantic versions and their comparison

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/arkuuu/semantic-version

v0.1.0 2019-12-12 22:20 UTC

This package is auto-updated.

Last update: 2025-10-29 02:23:43 UTC


README

A small PHP library to handle semantic versions and compare them to each other.

This is a small library with restricted real life use. I mainly created it to practice unit testing, github actions and publishing to packagist. If you really need a library like this, try Composer\Semver.

Installation

Use composer to install from packagist.

composer require arkuuu/semantic-version

Usage

$currentVersion = new Version('1.0.17');
$minimalVersion = new Version('1.0');
$versionOk = $currentVersion->isGreaterOrEqual($minimalVersion);
// $versionOk will be "true"


$versionA = new Version('1.0.17');
$versionB = new Version('1.0.25');
$sameVersions = $versionA->isSame($versionB);
// $sameVersions will be "false"

Ideas for the future

  • Refactor comparisons into own class
  • Support check against version constraints (^, ~ etc)
  • Support wildcards (e.g. 1.4.*)
  • Support more comparisons (e.g. less than)