PHPackages                             rollerworks/version - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. rollerworks/version

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

rollerworks/version
===================

Semantic versioning helper library

v0.3.3(2y ago)835.7k↓25%3[1 issues](https://github.com/rollerworks/version/issues)MITPHPPHP ^7.1|^8.0CI passing

Since Mar 19Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/rollerworks/version)[ Packagist](https://packagist.org/packages/rollerworks/version)[ RSS](/packages/rollerworks-version/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (0)

Rollerworks Semver Component
============================

[](#rollerworks-semver-component)

A small Semantic Versioning helper library.

Validation Continues Versions. Finding next possible version version increments.

Requirements
------------

[](#requirements)

You need at least PHP 7.1

Installation
------------

[](#installation)

To install this package, add `rollerworks/version` to your composer.json

```
$ php composer.phar require rollerworks/version
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Now, Composer will automatically download all required files, and install them for you.

Basic usage
-----------

[](#basic-usage)

```
require 'vendor/autoload.php';

use Rollerworks\Component\Version\Version;
use Rollerworks\Component\Version\VersionsValidator;

// Creates an immutable Version value-object.
// Any call to this object will produce a new Version object
$version = Version::fromString('v1.3.2');

$newVersion = $version->increase('major');  // v2.0.0
$newVersion = $version->increase('minor');  // v1.4.0
$newVersion = $version->increase('next');   // v1.4.0
$newVersion = $version->increase('patch');  // v1.3.3
$newVersion = $version->increase('stable'); // v1.4.0

$newVersion = $version->increase('alpha'); // v1.4.0-ALPHA1
$newVersion = $version->increase('beta');  // v1.4.0-BETA1
$newVersion = $version->increase('rc');    // v1.4.0-RC1

// ...
// Increasing minor or patch is prohibited until the meta-ver (alpha,beta,rc) is 0
// For patch this resolves to "next".

$version = Version::fromString('v1.4.0-BETA1');
$newVersion = $version->increase('beta');   // v1.4.0-BETA2
$newVersion = $version->increase('rc');     // v1.4.0-RC1
$newVersion = $version->increase('major');  // v1.4.0
$newVersion = $version->increase('next');   // v1.4.0-BETA2
$newVersion = $version->increase('patch');  // v1.4.0-BETA2
$newVersion = $version->increase('stable'); // v1.4.0

// Version validation
// ... //

$existingVersions = [
    Version::fromString('0.1.0'),
    Version::fromString('v1.0.0-beta1'),
    Version::fromString('v1.0.0-beta2'),
    Version::fromString('v1.0.0-beta6'),
    Version::fromString('v1.0.0-beta7'),
    Version::fromString('1.0.0'),
    Version::fromString('v1.0.1'),
    Version::fromString('v1.1.0'),
    Version::fromString('v2.0.0'),
    Version::fromString('v3.5-beta1'),
];

$validator = new ContinuesVersionsValidator(...$existingVersions); // Expects the versions as a variadic arguments
//$validator = new ContinuesVersionsValidator(); // No existing versions

VersionsValidator::isVersionContinues(Version::fromString('v1.1.1'));      // true
VersionsValidator::isVersionContinues(Version::fromString('1.0.2'));       // true
VersionsValidator::isVersionContinues(Version::fromString('1.1.1.'));      // true
VersionsValidator::isVersionContinues(Version::fromString('2.0.1.'));      // true
VersionsValidator::isVersionContinues(Version::fromString('3.5.0-beta2')); // true
VersionsValidator::isVersionContinues(Version::fromString('3.5.0'));       // true

// A new minor or major version is not considered acceptable when there are already higher
// versions. Only patch releases are accepted then.
VersionsValidator::isVersionContinues(Version::fromString('0.2.0'));        // false
VersionsValidator::isVersionContinues(Version::fromString('v1.0.0-beta8')); // false
VersionsValidator::isVersionContinues(Version::fromString('v1.2'));         // false
VersionsValidator::isVersionContinues(Version::fromString('v2.1'));         // false
VersionsValidator::isVersionContinues(Version::fromString('v3.5-alpha1'));  // false
VersionsValidator::isVersionContinues(Version::fromString('v3.5-beta3'));   // false
VersionsValidator::isVersionContinues(Version::fromString('v3.6'));         // false

// A list of possible versions with respect to the major.minor bounds of any existing version
// For higher major.minor versions then validated only suggests a patch release, otherwise
// all possible increments till the next stable major are suggested.
$possibleVersions = $validator->getPossibleVersions();
```

Versioning
----------

[](#versioning)

For transparency and insight into the release cycle, and for striving to maintain backward compatibility, this package is maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

`..`

And constructed with the following guidelines:

- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit .

License
-------

[](#license)

The source of this package is subject to the MIT license that is bundled with this source code in the file [LICENSE](LICENSE).

This library is maintained by [Sebastiaan Stok](https://github.com/sstok).

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance54

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 89.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~519 days

Recently: every ~586 days

Total

6

Last Release

749d ago

PHP version history (3 changes)v0.1.0PHP ^7.0

v0.3.0PHP ^7.1

v0.3.1PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0e812c04e848e9cc3afe6e966d2b81e81308124d96ce5f54eff4db0f8db0ea9?d=identicon)[sstok](/maintainers/sstok)

---

Top Contributors

[![sstok](https://avatars.githubusercontent.com/u/904790?v=4)](https://github.com/sstok "sstok (25 commits)")[![acrobat](https://avatars.githubusercontent.com/u/1374857?v=4)](https://github.com/acrobat "acrobat (3 commits)")

---

Tags

phprollerworkssemvervalidationversion

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rollerworks-version/health.svg)

```
[![Health](https://phpackages.com/badges/rollerworks-version/health.svg)](https://phpackages.com/packages/rollerworks-version)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
