circle33/flysystem-qcloud

qcloud filesystem package

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

dev-master 2019-03-13 10:07 UTC

This package is auto-updated.

Last update: 2024-04-13 21:04:22 UTC


README

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