PHP code example of yangweijie / filesystem-github

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

    

yangweijie / filesystem-github example snippets


use pkg6\flysystem\github\GithubAdapter;
use League\Flysystem\Filesystem;

$token='xxxxxx';
$username='xxxxxx';
$repository='test';
$adapter = new GithubAdapter($token,$username,$repository);
$flysystem = new League\Flysystem\Filesystem($adapter);


false|array $flysystem->write('file.md', 'contents');

false|array $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));

false|array $flysystem->update('file.md', 'new contents');

false|array $flysystem->updateStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));

false|array $flysystem->delete('file.md');

bool $flysystem->has('file.md');

bool $flysystem->rename('file.md','newfile.md');

bool $flysystem->copy('file.md','newfile.md');

false|array $flysystem->read('file.md');

string|false $flysystem->readStream('file.md');

array $flysystem->listContents();

string|false $flysystem->getMetadata('file.md');

int $flysystem->getSize('file.md');

string $flysystem->getAdapter()->getUrl('file.md'); 

string|false $flysystem->getMimetype('file.md');