PHP code example of eiriksm / gitinfo

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

    

eiriksm / gitinfo example snippets


use eiriksm\GitInfo\GitInfo;
$info = new GitInfo();
$hash = $info->getShortHash(); // Example output: f09037f
$date = $info->getDate(); // Example output (last commit date): 2020-05-31 09:05:40
$version = $info->getVersion(); // Example output: 1.1.1-2-gf09037f, or if on a clean tag: 1.1.1
$app_version = $info->getApplicationVersionString(); // v.1.1.1-2-gf09037f.f09037f (2020-05-31 09:05:40)