PHP code example of rummykhan / github-reader

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

    

rummykhan / github-reader example snippets


composer 

\GithubReader\GithubReaderServiceProvider::class,

'GithubReader' => \GithubReader\Facades\GithubReader::class,

php artisan vendor:publish

'app' => [
    'clientId'     => 'xxx**************xxx',
    'clientSecret' => 'xxx**************xxx',
    'method'       => 'application',
    // 'backoff'      => false,
    // 'cache'        => false,
    // 'version'      => 'v3',
    // 'enterprise'   => false,
],

$repository = app('github-reader')->read('rummykhan', 'github-reader');

dd($repository);

$repository = app('github-reader')->read('rummykhan', 'github-reader');

$files = $repository->getFiles();

// This method will retrieve file from github
$file = $files->first()->retrieve();

dd($file->getContent());

$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$file = $repository->getFiles()->where('name', 'LICENSE')->first();

dd($file);

$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$file = $repository->whereInFiles('name', 'LICENSE')->first();

dd($file);


$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$dictionary = $repository->getDirectories()->where('name', 'src')->first();

dd($dictionary);

$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$dictionary = $repository->whereInDictionaries('name', 'src')->first();

dd($dictionary);

$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$found = $repository->find('type', 'file');

dd($found);

$repository = app('github-reader')
        ->read('rummykhan', 'github-reader');

$found = $repository->find('name', 'File.php', true);

dd($found);


$reader = app('github-reader')

$directory = app('github-reader')
	->setOrganization('rummykhan')
	->setRepositoryName('github-reader')
	->readPath('src');

$repository = app('github-reader')->read('rummykhan','github-reader');
 

$repository = app('github-reader')->read('rummykhan','github-reader');

$file = $repository->getFiles()->first();

$repository = app('github-reader')->read('rummykhan','github-reader');
$file = $repository->getFiles()->first();
$fileContent = $file->retrieve();