PHP code example of mrpunyapal / git-reader
1. Go to this page and download the library: Download mrpunyapal/git-reader 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/ */
mrpunyapal / git-reader example snippets
use GitReader\RemoteRepository;
$repo = new RemoteRepository('https://github.com/laravel/framework.git');
$ref = $repo->resolveRef('12.x');
$store = $repo->fetchTipSnapshot($ref->sha);
$docs = $store->resolveTreePath($store->commitTreeSha($ref->sha), 'docs');
foreach ($store->flattenTree($docs->sha) as $entry) {
echo $entry['path'], "\n";
}
$contents = $store->object($entry['sha'])->data;
$store->cleanup();