overtrue/flysystem-qiniu

Qiniu 存储的 Flysystem 适配器。

3.2.3 2023-12-21 14:40 UTC

This package is auto-updated.

Last update: 2024-09-22 15:16:13 UTC


README

💾 Qiniu 云存储的 Flysystem 适配器。

Build Status Latest Stable Version Latest Unstable Version Scrutinizer Code Quality Code Coverage Total Downloads License

Sponsor me

要求

  • PHP >= 8.0.2

安装

$ composer require "overtrue/flysystem-qiniu"

使用方法

use League\Flysystem\Filesystem;
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
use Overtrue\Flysystem\Qiniu\Plugins\FetchFile;

$accessKey = 'xxxxxx';
$secretKey = 'xxxxxx';
$bucket = 'test-bucket-name';
$domain = 'xxxx.bkt.clouddn.com'; // or with protocol: https://xxxx.bkt.clouddn.com

$adapter = new QiniuAdapter($accessKey, $secretKey, $bucket, $domain);

$flysystem = new League\Flysystem\Filesystem($adapter);

API

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->rename('foo.md', 'bar.md');
bool $flysystem->copy('foo.md', 'foo2.md');
bool $flysystem->delete('file.md');
bool $flysystem->has('file.md');
bool $flysystem->fileExists('file.md');
bool $flysystem->directoryExists('path/to/dir');
string|false $flysystem->read('file.md');
array $flysystem->listContents();
int $flysystem->fileSize('file.md');
string $flysystem->mimeType('file.md');

适配器扩展方法

string $adapter->getUrl('file.md');
bool|array $adapter->fetch(string $path, string $url);
array $adapter->refresh(string $path);
string $adapter->getTemporaryUrl($path, int|string|\DateTimeInterface $expiration);
string $adapter->privateDownloadUrl(string $path, int $expires = 3600);
string $adapter->getUploadToken(string $key = null, int $expires = 3600, string $policy = null, string $strictPolice = null)

集成

❤️ 赞助我

Sponsor me

如果你喜欢我的项目并想支持它,点击这里 ❤️

项目由 JetBrains 支持

非常感谢 JetBrains 善意提供许可证,让我可以从事这个和其他开源项目的工作。

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我将在该课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

许可证

MIT