Skip to content

CodeLingoBot/flysystem-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flysystem Adapter for Github

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Install

Via Composer

$ composer require potherca/flysystem-github

Usage

The Github adapter can be used without credentials to do read-only actions on public repositories. To save changes or read from private repositories, credentials are required.

To avoid the Github API limit or to save traffic caching can be utilized.

Basic Usage

use Github\Client;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\GithubAdapter;

$project = 'thephpleague/flysystem';

$client = new Client();
$adapter = new GithubAdapter($client, $project);

$filesystem = new Filesystem($adapter);

Authentication

use Github\Client;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\GithubAdapter;

$project = 'thephpleague/flysystem';

$client = new Client();
$client->authenticate($token, null, Client::AUTH_HTTP_TOKEN);
// or $client->authenticate($username, $password, Client::AUTH_HTTP_PASSWORD);
$adapter = new GithubAdapter($client, $project);

$filesystem = new Filesystem($adapter);

For full details, see the php-github-api documentation concerning authentication.

Cache Usage

use Github\Client;
use Github\HttpClient\CachedHttpClient as CachedClient;
use Github\HttpClient\Cache\FilesystemCache as Cache;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\GithubAdapter;

$project = 'thephpleague/flysystem';

$cache = new Cache('/tmp/github-api-cache')
$cacheClient = new CachedClient();
$cacheClient->setCache($cache);

$client = new Client($cacheClient);
$adapter = new GithubAdapter($client, $project);

$filesystem = new Filesystem($adapter);

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email potherca@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Flysystem adapter for Github.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%