PHP code example of anton-am / selectel-cloud-api

1. Go to this page and download the library: Download anton-am/selectel-cloud-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anton-am / selectel-cloud-api example snippets




use AntonAm\Selectel\Cloud\Manager;

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

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

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