Via Composer
$ composer require potherca/flysystem-github
The Github adapter can be used without credentials to do read-only actions on public repositories. To avoid reaching the Github API limit, to save changes, or to read from private repositories, credentials are required.
Caching can be utilized to save traffic or to postpone reaching the Github API limit.
use Github\Client;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Api;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;
$project = 'thephpleague/flysystem';
$settings = new Settings($project);
$api = new Api(new Client(), $settings);
$adapter = new GithubAdapter($api);
$filesystem = new Filesystem($adapter);
use Github\Client;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Api;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;
$project = 'thephpleague/flysystem';
$credentials = [Settings::AUTHENTICATE_USING_TOKEN, '83347e315b8bb4790a48ed6953a5ad9e825b4e10'];
// or $authentications = [Settings::AUTHENTICATE_USING_PASSWORD, $username, $password];
$settings = new Settings($project, $credentials);
$api = new Api(new Client(), $settings);
$adapter = new GithubAdapter($api);
$filesystem = new Filesystem($adapter);
use Github\Client;
use Github\HttpClient\CachedHttpClient as CachedClient;
use Github\HttpClient\Cache\FilesystemCache as Cache;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Api;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;
$project = 'thephpleague/flysystem';
$settings = new Settings($project);
$cache = new Cache('/tmp/github-api-cache')
$cacheClient = new CachedClient();
$cacheClient->setCache($cache);
$api = new Api($cacheClient, $settings);
$adapter = new GithubAdapter($api);
$filesystem = new Filesystem($adapter);
$ composer test
If you discover any security related issues, please email potherca@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
Please see CHANGELOG for details.
The MIT License (MIT). Please see License File for more information.