PHPackages                             starburst/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. starburst/version

ActiveLibrary

starburst/version
=================

1.0.0(1mo ago)03MITPHPPHP ^8.4CI passing

Since Jul 13Pushed 1mo agoCompare

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

READMEChangelogDependencies (5)Versions (2)Used By (0)

Starburst Version
=================

[](#starburst-version)

[![Build Status](https://github.com/StarburstPhp/version/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/StarburstPhp/version/actions/workflows/continuous-integration.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/dccfa4325f4bc90c9232e42d2f3378d0b4732f58e60189200d004169684185fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374617262757273742f76657273696f6e2e737667)](https://packagist.org/packages/starburst/version)[![Software License](https://camo.githubusercontent.com/1573b8c6897e347d6c528e7fd88f83b7ef2d775f8ad742337ab5757f41d3d5f7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5374617262757273745068702f76657273696f6e2e737667)](LICENSE.md)

A PHP library for parsing, comparing, and bumping versions, supporting both Semantic Versioning (SemVer) and Calendar Versioning (CalVer).

Features
--------

[](#features)

- Parse version strings and arrays.
- Support for [Semantic Versioning 2.0.0](https://semver.org/).
- Support for Calendar Versioning (`YYYY.MM.DD`).
- Comprehensive version comparison (greater than, less than, equal to, etc.).
- Support for Pre-release and Build metadata.
- Version bumping for both SemVer and CalVer.
- JSON serializable version objects.

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

[](#requirements)

- PHP 8.4 or higher.

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

[](#installation)

You can install the package via Composer:

```
composer require starburst/version
```

Usage
-----

[](#usage)

### Parsing Versions

[](#parsing-versions)

Use the `Parser` class to create version objects from strings or arrays.

```
use Starburst\Version\Parser;

$parser = new Parser();

// Parse Semantic Versioning
$version = $parser->parseString('1.2.3-alpha.1+build.123');

// Parse Calendar Versioning
$calVer = $parser->parseString('2024.05.20');

// Parse from array
$versionFromArray = $parser->parseArray([
    'major' => 1,
    'minor' => 2,
    'patch' => 3,
]);
```

### Comparing Versions

[](#comparing-versions)

Version objects provide several methods for comparison.

```
$v1 = $parser->parseString('1.2.3');
$v2 = $parser->parseString('1.2.4');

$v1->isLessThan($v2);         // true
$v1->isGreaterThan($v2);      // false
$v1->isEqualTo('1.2.3');      // true
$v1->compareTo($v2);          // -1
```

### Bumping Versions

[](#bumping-versions)

You can bump versions using the `Bump` enum.

```
use Starburst\Version\Bump;

$version = $parser->parseString('1.2.3');
$nextVersion = $version->bump(Bump::Minor); // 1.3.0

// with pre-release and build metadata
$nextVersion = $version->bump(
	Bump::Path,
	preRelease: PreRelease::from('alpha', '1'),
	buildMetaData: BuildMetaData::from('f3b2974'),
); // Today's date (e.g., 1.2.4-alpha.1+f3b2974)
```

For `CalendarVersion`, bumping typically uses the current date:

```
$version = $parser->parseString('2024.01.01');
$nextVersion = $version->bump(); // Today's date (e.g., 2026.07.13)

// or specify a specific date
$nextVersion = $version->bump(releaseData: new DateTimeImmutable('2024-01-01')); // 2024.01.01

// with pre-release and build metadata
$nextVersion = $version->bump(
	preRelease: PreRelease::from('alpha', '1'),
	buildMetaData: BuildMetaData::from('f3b2974'),
); // Today's date (e.g., 2026.07.13-alpha.1+f3b2974)
```

Scripts &amp; Development
-------------------------

[](#scripts--development)

The project uses the following tools for development:

- **Tests**: `vendor/bin/phpunit`
- **Static Analysis**: `vendor/bin/phpstan analyse`
- **Coding Style**: `vendor/bin/phpcs`

License
-------

[](#license)

This project is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for details.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

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

---

Top Contributors

[![sunkan](https://avatars.githubusercontent.com/u/568492?v=4)](https://github.com/sunkan "sunkan (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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