PHP code example of buuum / git

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

    

buuum / git example snippets


$repository_path = __DIR__;
$git = new \Buuum\Git($repository_path);

$git->getCurrentBranch();

$git->getCommits();

$git->getAllFiles();

$git->getDiffCommits($from,$to);

$git->getDiff(1);

$git->isWorkingCopyClean();

array(2) {
  ["f70a8a70c3504257d8ccc79d2c759ee743b9391d"]=>
  array(4) {
    ["commit"]=>
    string(40) "f70a8a70c3504257d8ccc79d2c759ee743b9391d"
    ["author"]=>
    string(27) "buuum <[email protected]>"
    ["date"]=>
    string(29) "Sun May 1 15:51:51 2016 +0200"
    ["message"]=>
    string(14) "Initial commit"
  }
  ["cda360828e92443bfc0c19129794fd7729b7f7c8"]=>
  array(4) {
    ["commit"]=>
    string(40) "cda360828e92443bfc0c19129794fd7729b7f7c8"
    ["author"]=>
    string(47) "buuum <[email protected]>"
    ["date"]=>
    string(30) "Thu May 12 08:15:31 2016 +0200"
    ["message"]=>
    string(14) "initial commit"
  }
}