granam / web-versions
Reads available minor and patch versions from a Git repository
1.1.1
2021-08-30 07:07 UTC
Requires
- php: >= 7.3
- granam/git: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.4
- roave/security-advisories: dev-latest
- symfony/process: ^5.1
README
Reads minor versions, like 1.0, 1.1, 2.0
and patch versions, like 1.0.0, 1.0.1, 1.1.0, 2.0.0, 2.0.1
from given Git repository.
Originally created for a cache invalidation using a Git version as a cache key (that is where the Web versions name came from).
Caveats
- Minor versions reads only from Git branches, filtered for those named version-like (
v1.0
or1.0
) - Patch versions reads only from Git tags, filtered for those named version-like (
v1.0.0
or1.0.0
)
Usage
<?php require_once __DIR__ . '/vendor/autoload.php'; $git = new \Granam\Git\Git(); $webVersions = new \Granam\WebVersions\WebVersions($git, __DIR__, 'dev-branch-name'); print_r($webVersions->getAllMinorVersions()); // Array ( [0] => dev-branch-name [1] => 1.0 ) print_r($webVersions->getAllStableMinorVersions()); // Array ( [0] => 1.0 ) print_r($webVersions->getAllPatchVersions()); // Array ( [0] => dev-branch-name [1] => 1.0.0 ) print_r($webVersions->getAllStablePatchVersions()); // Array ( [0] => 1.0.0 )
Install
Easiest via Composer
composer require granam/web-versions