anton-am/selectel-cloud-api

Selectel 对象存储的简单 API 封装

1.0.4 2023-11-25 16:19 UTC

This package is auto-updated.

Last update: 2024-09-25 17:59:54 UTC


README

Selectel 对象存储的简单 API 封装。

安装

  • 使用 Composer:
composer require anton-am/selectel-cloid-api

连接

require_once('vendor/autoload.php');

use AntonAm\Selectel\Cloud\Manager;

$key = 'ACCOUNT_ID_USER';
$secret = 'USER_PASSWORD';
$containerName = 'CONTAINER_NAME';

$client = new Manager($key, $secret, $containerName);

所有可用选项

Manager(必需的密钥,必需的秘密,可选的容器名称,可选的区域,可选的主机);

 

上传/下载文件

$pathToFileInContainer = 'image.png';
$pathToFile = '/app/image.png';
$client->file($pathToFileInContainer)->setFileData($pathToFile)->create();


$downloadFile = 'image.png';
$saveAs = '/app/folder/downloaded-image.png';

$client->file($downloadFile)->download($saveAs);

 

删除文件/文件夹

$pathToFileInContainer = 'image.png';

$client->file($pathToFileInContainer)->delete();