qgmac / cloud_object_storage
云对象存储集成客户端
0.1.1
2024-07-29 08:11 UTC
Requires
- ext-fileinfo: *
- alibabacloud/credentials: ^1.1
- aliyuncs/oss-sdk-php: ^2.7
- obs/esdk-obs-php: ^3.23
- qcloud/cos-sdk-v5: ^2.6
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-03-29 01:08:55 UTC
README
云对象存储集成客户端.
Installing
$ composer require qgmac/cloud_object_storage -vvv
Usage
$config = [ 'default' => 'cos',//默认 'disks' => [ 'cos' => [// 腾讯云 'driver' => 'cos', 'secret_id' => '', 'secret_key' => '', 'region' => '', 'bucket' => '', 'url' => '', ], 'obs' => [// 华为云 'driver' => 'obs', 'key' => '', 'secret' => '', 'bucket' => '', 'url' => '', 'endpoint' => '', ], 'oss' => [// 阿里云 'driver' => 'obs', 'key' => '', 'secret' => '', 'role_arn' => '',//即需要扮演的角色ID,格式为acs:ram::$accountID:role/$roleName 'bucket' => '', 'url' => '', 'endpoint' => '', ], ], ]; $store_key = "/test/test.jpg"; $manager = new Manager($config); $default_store_url = $manager->store()->uploadFile($_file, $head_url); $cos_url = $manager->store('cos')->uploadFile($_file, $head_url); $obs_url = $manager->store('obs')->uploadFile($_file, $head_url); $oss_url = $manager->store('oss')->uploadFile($_file, $head_url); $manager->store('cos')->deleteFile($store_key) bool; $manager->store('cos')->getFileUrl($store_key) string; $manager->store('cos')->exist($store_key) bool;
ps OSS配置参考:使用长期访问凭证
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- 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.
License
MIT