PHP code example of valerian / git
1. Go to this page and download the library: Download valerian/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/ */
valerian / git example snippets
$git = new Valerian\Git('path to folder with project');
//Get git statuslicense.md
var_dump($git->status());
//Get git diff
var_dump($git->diff());
//Get git pull
var_dump($git->pull());
//Get git log (last 5 logs)
var_dump($git->log(5));
//Get last log
$lastLog = $git->getLastLog();
var_dump($lastLog);
//Get git show
$show = $git->show($lastLog['commit']);
var_dump($show);
//Get git local branches
var_dump($git->getLocalBranches());
//Get git branches
var_dump($git->getRemoteBranches());
//Get git current branch
var_dump($git->getCurrentBranch());