kalax2 / flysystem-huaweicloud-obs
HuaweiCloud OBS adapter for Flysystem.
1.0.0
2024-09-05 08:34 UTC
Requires
- php: >=8.0
- kalax2/huaweicloud-obs-client: ^1.0
- league/flysystem: ^3.0
Requires (Dev)
- league/flysystem-adapter-test-utilities: ^3.28
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-03-05 10:01:28 UTC
README
华为云对象存储服务OBS Flysystem Adapter
使用方法
安装
composer require kalax2/flysystem-huaweicloud-obs
示例
use Kalax2\Flysystem\Obs\ObsAdapter; use League\Flysystem\Filesystem; $adapter = new ObsAdapter( // Access Key accessKey: 'AccessKey', // Secret Key secretKey: 'SecretKey', // 地域,注意不是控制台的Endpoint域名 // 请看地域列表:https://console.huaweicloud.com/apiexplorer/#/endpoint/OBS region: 'cn-north-1', // 存储桶名称 bucket: 'BucketName', // 额外配置,可选 config: [ 'guzzle' => [] // GuzzleHttp 配置 'ssl' => true // 是否使用https,只影响temporaryUrl()和getUrl()返回的Url 'domain' => 'abc.example.com' // 自定义域名 ] ); $filesystem = new Filesystem($adapter); $filesystem->write('hello/world.txt', 'Hello, World!'); $filesystem->move('hello/world.txt', 'hello world.txt'); $filesystem->fileExists('hello/world.txt'); $filesystem->setVisibility('hello/world.txt', Visibility::PUBLIC);
更多信息请参考 Flysystem 官方文档