https://github.com/pkg6/flysystem-github
flysystem for github
https://github.com/pkg6/flysystem-github
Last synced: 3 months ago
JSON representation
flysystem for github
- Host: GitHub
- URL: https://github.com/pkg6/flysystem-github
- Owner: pkg6
- License: mit
- Created: 2023-03-07T07:49:07.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T07:52:42.000Z (about 2 years ago)
- Last Synced: 2025-01-09T11:40:50.522Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Flysystem Github
# Requirement
- PHP >= 7.2
# install
~~~
composer require pkg6/flysystem-github
~~~# CDN List
~~~
'github' => "https://raw.githubusercontent.com/:username/:repository/:branch/:fullfilename",
'fastgit' => "https://hub.fastgit.org/:username/:repository/blob/:branch/:fullfilename?raw=true",
'jsdelivr' => "https://cdn.jsdelivr.net/gh/:username/:repository@:branch/:fullfilename"
~~~# Usage
```php
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);```
## API
```php
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');
```## Plugins
File Url:
```
use pkg6\flysystem\github\Plugins\FileUrl;
$flysystem->addPlugin(new FileUrl());
string $flysystem->getUrl('file.md');
```