💾 Flysystem adapter for the Qcloud COS storage.
- PHP >= 7.0
$ composer require overtrue/flysystem-cos -vvv
use League\Flysystem\Filesystem;
use Overtrue\Flysystem\Cos\CosAdapter;
$secretId = 'AKIDsiQzQla780mQxLLU2GJC6xxxxxxxxxx';
$secretKey = 'b0GMH2c2NXWKxPhy7xxxxxxxxxxxx';
$region = 'ap-guangzhou';
$bucket = 'overtrue-123456789';
$adapter = new CosAdapter($secretId, $secretKey, $bucket, $region);
$flysystem = new League\Flysystem\Filesystem($adapter);
bool $flysystem->write('file.md', 'contents');
bool $flysystem->write('file.md', 'http://httpbin.org/robots.txt', ['mime' => 'application/redirect302']);
bool $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));
bool $flysystem->update('file.md', 'new contents');
bool $flysystem->updateStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));
bool $flysystem->rename('foo.md', 'bar.md');
bool $flysystem->copy('foo.md', 'foo2.md');
bool $flysystem->delete('file.md');
bool $flysystem->has('file.md');
string|false $flysystem->read('file.md');
array $flysystem->listContents();
array $flysystem->getMetadata('file.md');
int $flysystem->getSize('file.md');
string $flysystem->getAdapter()->getUrl('file.md');
string $flysystem->getMimetype('file.md');
int $flysystem->getTimestamp('file.md');
TODO
MIT