PHP code example of mazanax / composer-version-semver
1. Go to this page and download the library: Download mazanax/composer-version-semver library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mazanax / composer-version-semver example snippets
$packageVersion = \MZNX\ComposerPackageSemver\PackageVersionSemver::init(__DIR__ . '/path/to/composer.json');
$version = $packageVersion->getVersion();
echo $version->getMajor() . PHP_EOL;
echo $version->getMinor() . PHP_EOL;
echo $version->getPatch() . PHP_EOL;
$packageVersion = \MZNX\ComposerPackageSemver\PackageVersionSemver::init(__DIR__ . '/path/to/composer.json');
$version = $packageVersion->getVersionAsString();
echo $version . PHP_EOL;