GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Potherca/flysystem-github: Flysystem adapter for Github.

BranchesTags
Open more actions menu

Latest commit

 

History

130 Commits
130 Commits

Folders and files

NameName
Last commit message
Last commit date
build
build
 
 
src
src
 
 
tests
tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

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 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.

Basic Usage

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);

Authentication

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);

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\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);

Testing

The unit-tests can be run with the following command:

$ composer test

To run integration tests, which use the Github API, a Github API token might be needed (to stop the tests hitting the API Limit). An API key can be added by setting it in the environment as GITHUB_API_KEY or by creating an .env file in the integration tests directory and setting it there. See tests/integration-tests/.env.example for an example.

To run the integration test, run the following command (this will also run the unit-tests):

$ composer test-all

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Change Log

Please see CHANGELOG for details.

Credits

  • Potherca
  • Contributors

License

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

About

Flysystem adapter for Github.

Topics

filesystemflysystemflysystem-adapterpackagistphppotherca

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

11 stars

Watchers

3 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.