Flysystem adapter for the qcloud storage.
$ composer require circle33/flysystem-qcloud -vvv
use League\Flysystem\Filesystem;
use Circle33\Flysystem\Qcloud\QcloudAdapter;
$secretId = 'xxxxxx';
$secretKey = 'xxxxxx';
$bucket = 'xxxxxx';
$region = 'xxxxxx';
$adapter = new QcloudAdapter($secretId, $secretKey, $bucket, $region);
$filesystem = new League\Flysystem\Filesystem($adapter);
Use in laravel
composer require circle33/flysystem-qcloud -vvv
Add config to your fliesystems.php
'disks' => [
...
'qcloud_oss' => [
'driver' => 'qcloud_oss',
'region' => env('QCLOUDREGION', ''),
'secretId' => env('QCLOUDSECRETID', ''),
'secretKey' => env('QCLOUDSECRETKEY', ''),
'bucket' => env('QCLOUDBUCKET', ''),
],
...
],
$filesystem = Storage::disk('qcloud_oss');
It exposes a user interface allowing you to manage your files.If you want to add to your project,you need to:
php artisan vendor:publish --provider=Circle33\\Flysystem\\Qcloud\\QcloudServiceProvider
php artisan migrate
Navigate to http://your-project.test/circle33qcloud (update circle33qcloud
to match the circle33_qcloud.ui_url
configuration setting) and use the interface to manage your files.
$filesystem->write('file.md', 'contents');
$filesystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'rb'));
$filesystem->update('file.md', 'new contents');
$filesystem->updateStream('file.md', fopen('path/to/your/local/file.jpg', 'rb'));
$filesystem->rename('foo.md', 'foo2.md');
$filesystem->copy('foo.md', 'foo2.md');
$filesystem->delete('file.md');
$filesystem->has('file.md');
$filesystem->read('file.md');
$filesystem->listContents('your qcloud oss filelist path');
$filesystem->getMetadata('file.md');
$filesystem->getSize('file.md');
$filesystem->getMimetype('file.md');
$filesystem->getTimestamp('file.md');
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
MIT