PHP code example of fostam / buildinfo

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

    

fostam / buildinfo example snippets


buildinfo create buildinfo.php --set-version 2.1.0 --set-commit d921970aadf03b3cf0e71becdaab3147ba71cdef

$buildInfo = BuildInfo::fromFile('buildinfo.php');
echo "my application version: " . $buildInfo->getVersion();

buildinfo create dist/buildinfo.php dist/buildinfo.json --set-version 2.1.0

use Fostam\Buildinfo;

$buildInfo = BuildInfo::fromFile('buildinfo.json');
echo $buildInfo->getName();
echo $buildInfo->getTime();
echo $buildInfo->getVersion();
echo $buildInfo->getBuildNumber();
echo $buildInfo->getBranch();
echo $buildInfo->getCommit();

echo $buildInfo->get('author');
echo $buildInfo->get('comment');

$dt = $buildInfo->getTimeAsDateTime();
echo $dt->format(DateTime::RFC3339);