floppy_disk: 又拍云 Flysystem 实现
- PHP >= 7.2
- League/Filesystem >=2.0
直接可以通过 composer 来安装:
$ composer require yzh52521/flysystem-upyun 2.0
use League\Flysystem\Filesystem;
use yzh52521\Flysystem\Upyun\UpyunAdapter;
$bucket = 'your-bucket-name';
$operator = 'oparator-name';
$password = 'operator-password';
$domain = 'xxxxx.b0.upaiyun.com'; // 或者 https://xxxx.b0.upaiyun.com
$protocol='https', // 服务使用的协议,如需使用 http,在此配置 http
$adapter = new UpyunAdapter($bucket, $operator, $password, $domain,$protocol);
$flysystem = new Filesystem($adapter);
bool $flysystem->write('file.md', 'contents');
bool $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));
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->getUrl('file.md');
string $flysystem->getMimetype('file.md');
MIT