1. Go to this page and download the library: Download grimzy/git-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/ */
$gitInfo = new \Grimzy\GitInfo\GitInfo(null, [
'status' => 'git status'
]);
$info = $gitInfo->getInfo('status');
// $info = THE STATUS
// Add the status command
GitInfo::addCommand('status', 'git status');
// All instances of GitInfo (existing and newly created) will now have a status command
$gitInfo = new GitInfo();
$info = $gitInfo->getInfo('status');
// $info = THE STATUS
// When instantiating GitInfo
$gitInfo = new \Grimzy\GitInfo\GitInfo('absolute/or/relative/path');