2017 © Pedro Peláez
 

library versionkit

Versioning library

image

corneltek/versionkit

Versioning library

  • Saturday, December 12, 2015
  • by c9s
  • Repository
  • 1 Watchers
  • 5 Stars
  • 19 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

VersionKit

Build Status, (*1)

Utility functions for manipulating version strings., (*2)

$versionStrs = [
    'php-5.3.1',
    'php-5.3.22',
    'php-5.4',
    'php-5',
    'hhvm-3.2',
    'php-5.3.0-dev',
    'php-5.3.0-alpha3',
    'php-5.3.0-beta2',
    'php-5.3.0-RC5',
    '5.3.0-dev',
    '5.3.0-alpha3',
    '5.3.0-beta2',
    '5.3.0-RC5',
    '5.3.3',
    '5.3.0',
    '5.3',
    '5',
];
foreach ($versionStrs as $versionStr) {
    $version = new Version($versionStr);
    $version->major;
    $version->minor;
    $version->patch;
    $version->getVersionNumber(); // 5.3.2
    $version->getCanonicalizedVersionName(); // php-5.3.0-dev
    $version->compare(new Version('php-5.3.2'));
}

VersionCollection

$versions = new VersionCollection(['php-5.4.0', 'php-5.5.0', 'php-7.0.0', 'php-5.3.0', 'php-5.3.3']);

$this->assertTrue( $versions->sortAscending() );
$this->assertEquals('["php-5.3.0","php-5.3.3","php-5.4.0","php-5.5.0","php-7.0.0"]', $versions->toJson());

$this->assertTrue( $versions->sortDescending() );
$this->assertEquals('["php-7.0.0","php-5.5.0","php-5.4.0","php-5.3.3","php-5.3.0"]', $versions->toJson());

$versions = new VersionCollection(['php-5.3.0', 'php-5.3.3', 'php-5.4.0', 'php-5.5.0', 'php-7.0.0']);
$versions7 = $versions->filterByMajorVersion(7);
$versions5 = $versions->filterByMajorVersion(5);

The Versions

12/12 2015

dev-master

9999999-dev

Versioning library

  Sources   Download

MIT

by Avatar c9s