muqiuren / hyperf-flysystem-upyun
hyperf框架的flysystem文件系统的upyun存储驱动
v0.0.3
2025-03-03 06:04 UTC
Requires
- php: >=8.1
- alapi/upyun-sdk: ^4.0
- hyperf/filesystem: ^3.1
README
hyperf框架的flysystem文件系统的upyun(又拍云)的云存储驱动实现
安装
composer require muqiuren/hyperf-flysystem-upyun
快速使用
- hyperf配置config/autoload/file.php,添加upyun云存储配置(操作员名称、密码、存储服务名),又拍云文档
... 'storage' => [ ... 'upyun' => [ 'driver' => UpyunAdapterFactory::class, 'username' => env('UPYUN_USERNAME'), 'password' => env('UPYUN_PASSWORD'), 'bucket_name' => env('UPYUN_BUCKET'), 'options' => [ UpyunHeaderEnum::CONTENT_SECRET->value => 'common_secret' ] ] ]
- 通过FilesystemFactory调用云存储
// 上传文件 public function putObject(\Hyperf\Filesystem\FilesystemFactory $factory) { $storage = $factory->get('upyun'); $path = '/test/hello.txt'; $content = 'hello world'; $storage->write($path, $content, [ UpyunHeaderEnum::CONTENT_SECRET->value => 'custom_single_file_secret' ]); }
更多示例请参考example目录
TODO
- 列出目录文件内容
- 支持配置header以及meta信息