anton-am/selectel-cloud-api

A simple API wrapper for Selectel object storage

1.0.4 2023-11-25 16:19 UTC

This package is auto-updated.

Last update: 2024-10-25 18:07:37 UTC


README

A simple API wrapper for Selectel object storage.

Installation

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

Connecting

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);

All available options:

Manager(REQUIRED KEY, REQUIRED SECRET, OPTIONAL CONTAINER NAME, OPTIONAL REGION, OPTIONAL HOST);

 

Uploading/Downloading Files

$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);

 

Deleting Files/Folders

$pathToFileInContainer = 'image.png';

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