anton-am / selectel-cloud-api
A simple API wrapper for Selectel object storage
1.0.4
2023-11-25 16:19 UTC
Requires
- php: >=7.3.0
- ext-fileinfo: *
- ext-json: *
- ext-simplexml: *
- aws/aws-sdk-php: ^3.108
Requires (Dev)
- codeception/codeception: ^4.1.1
- codeception/module-asserts: ^1.1.1
- codeception/module-filesystem: ^1.0.2
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();