All Projects → PHLAK → Semver

PHLAK / Semver

Licence: mit
Semantic versioning helper library for PHP

Projects that are alternatives of or similar to Semver

Python Semver
Python package to work with Semantic Versioning (http://semver.org/)
Stars: ✭ 264 (+83.33%)
Mutual labels:  versioning, semver, semantic-versioning
React Native Version
🔢 Version your React Native or Expo app in a `npm version` fashion.
Stars: ✭ 408 (+183.33%)
Mutual labels:  versioning, semver, semantic-versioning
Version
Represent and compare versions via semantic versioning (SemVer) in Swift
Stars: ✭ 160 (+11.11%)
Mutual labels:  versioning, semver, semantic-versioning
Semver
Semantic Versioning for modern C++
Stars: ✭ 108 (-25%)
Mutual labels:  semver, semantic-versioning
Reckon
Infer a project's version from your Git repository.
Stars: ✭ 124 (-13.89%)
Mutual labels:  versioning, semver
Jgitver
jgit based library to calculate semver compatible version from git tree
Stars: ✭ 119 (-17.36%)
Mutual labels:  versioning, semver
sv4git
Semantic version and conventional commits for git
Stars: ✭ 33 (-77.08%)
Mutual labels:  versioning, semantic-versioning
Axion Release Plugin
Gradle release & version management plugin.
Stars: ✭ 372 (+158.33%)
Mutual labels:  versioning, semantic-versioning
Jsemver
Java implementation of the SemVer Specification
Stars: ✭ 360 (+150%)
Mutual labels:  versioning, semver
Commitizen
Create committing rules for projects 🚀 auto bump versions ⬆️ and auto changelog generation 📂
Stars: ✭ 477 (+231.25%)
Mutual labels:  semver, semantic-versioning
Grabver
Gradle Automatic Build Versioning Plugin - An easy Gradle plugin that follows semver.org rules to automatically generate the Patch version, Build number and Code version, while Major, Minor and Pre-Release suffix remain under our control.
Stars: ✭ 39 (-72.92%)
Mutual labels:  versioning, semver
bump
🌻 CLI tool to draft a GitHub Release for the next semantic version
Stars: ✭ 40 (-72.22%)
Mutual labels:  semver, semantic-versioning
perfekt
Release, changelog and version your packages with perfe(k)t 👌 ease!
Stars: ✭ 15 (-89.58%)
Mutual labels:  semver, versioning
git-semver
a small cli tool to version your git repository with semantic versioning
Stars: ✭ 19 (-86.81%)
Mutual labels:  semver, semantic-versioning
Semver
Semantic Versioning (semver) library written in golang
Stars: ✭ 804 (+458.33%)
Mutual labels:  semver, semantic-versioning
Poetry Dynamic Versioning
Plugin for Poetry to enable dynamic versioning based on VCS tags
Stars: ✭ 131 (-9.03%)
Mutual labels:  versioning, semantic-versioning
Semantic Release
📦🚀 semantic-release written in go
Stars: ✭ 113 (-21.53%)
Mutual labels:  semver, semantic-versioning
versiontag
Bash command to automate tag semantic versioning
Stars: ✭ 40 (-72.22%)
Mutual labels:  versioning, semantic-versioning
terraform-module-versions
CLI tool that checks Terraform code for module updates. Single binary, no dependencies. linux, osx, windows. #golang #cli #terraform
Stars: ✭ 143 (-0.69%)
Mutual labels:  semver, versioning
Shipjs
Take control of what is going to be your next release.
Stars: ✭ 668 (+363.89%)
Mutual labels:  versioning, semver

SemVer

SemVer

Semantic versioning helper library • Created by Chris Kankiewicz (@PHLAK)

Latest Stable Version Total Downloads License Build Status StyleCI
Join our Community Become a Sponsor One-time Donation


Requirements

Installation

composer require phlak/semver

Initializing

use PHLAK\SemVer;

$version = new SemVer\Version(); // Initilializes to '0.1.0'

Or initialize with a custom version by passing a version string on creation. Accepts any valid semantic version string with or without a preceding v.

$version = new SemVer\Version('v1.2.3-alpha.5+sha.8d31ff4');

Or parse an incomple version string with the static Version::parse() constructor.

$version = SemVer\Version::parse('v1') // Initializes to '1.0.0'
$version = SemVer\Version::parse('v1.2') // Initializes to '1.2.0'

Usage

Retrieve the version or individual values

$version = new SemVer\Version('v1.2.3-beta.4+007');

echo $version;             // '1.2.3-beta.4+007'
echo $version->major;      // 1
echo $version->minor;      // 2
echo $version->patch;      // 3
echo $version->preRelease; // 'beta.4'
echo $version->build;      // '007'

Increment the version

$version = new SemVer\Version('v1.2.3');

$version->incrementMajor(); // v1.2.3 -> v2.0.0
$version->incrementMinor(); // v1.2.3 -> v1.3.0
$version->incrementPatch(); // v1.2.3 -> v1.2.4

Set (override) the version or individual values

$version = new SemVer\Version();

$version->setVersion('v1.2.3');  // v1.2.3
$version->setMajor(3);           // v1.2.3 -> v3.0.0
$version->setMinor(5);           // v1.2.3 -> v1.5.0
$version->setPatch(7);           // v1.2.3 -> 1.2.7
$version->setPreRelease('rc.2'); // v1.2.3 -> v1.2.3-rc.2
$version->setBuild('007');       // v1.2.3 -> v1.2.3+007

Clear pre-release / build values

$version->setPreRelease(null); // v1.2.3-rc.2 -> v1.2.3
$version->setBuild(null);      // v1.2.3+007 -> v1.2.3

Compare two SemVer objects

$version1 = new SemVer('v1.2.3');
$version2 = new SemVer('v3.2.1');

$version1->gt($version2);  // false
$version1->lt($version2);  // true
$version1->eq($version2);  // false
$version1->neq($version2); // true
$version1->gte($version2); // false
$version1->lte($version2); // true

Troubleshooting

For general help and support join our Spectrum Community or reach out on Twitter.

Please report bugs to the GitHub Issue Tracker.

Copyright

This project is liscensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].