PHP code example of sanmai / version-info

1. Go to this page and download the library: Download sanmai/version-info 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/ */

    

sanmai / version-info example snippets


const VERSION_INFO = '$Format:%h%d by %an +%ae$'; // or '$Format:%h%d$'

$reader = \VersionInfo\PlaceholderVersionReader(MyVersion::VERSION_INFO);
$version = $versionReader->getVersionString();

if ($version !== null) {
    return $version;
}

// Fallback on other methods, or return a dummy version.
// See src/Example.php for a complete example.

use function Later\later;

$deferredVersion = later(function () {
    $reader = \VersionInfo\PlaceholderVersionReader(MyVersion::VERSION_INFO);
    
    yield $version = $versionReader->getVersionString();
});

// And at some later point...
$deferredVersion->get(); // returns memoized version string, computing it on the spot, as needed

/src/MyVersion.php     export-subst