rust17 / flysystem-qcloud

Qcloud OSS Storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qcloud filesystem

Flysystem adapter for the qcloud storage.

Doc

Installing

$ composer require circle33/flysystem-qcloud -vvv

Usage

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.

API

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

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. 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.

reference

License

MIT

About

Qcloud OSS Storage


Languages

Language:JavaScript 45.7%Language:PHP 30.8%Language:Vue 19.4%Language:CSS 2.3%Language:HTML 1.8%