PHP code example of garantpark / selectel

1. Go to this page and download the library: Download garantpark/selectel 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/ */

    

garantpark / selectel example snippets

 php
$storageInfo = $client->getStorageInfo();
 php
$containers = $client->getContainers();
 php
$containerType = 'public'; // or 'private'
$metaData = []; // Any meta data (will be stored as "X-Container-Meta-{KEY}: {Value}" header)
$result = $client->createContainer('container-name', $containerType, $metaData);
 php
$containerInfo = $client->getContainerInfo('container-name');
 php
$client->deleteContainer('container-name');
 php
$localFile = realpath('../../images/logo-big.png');
$remotePath = '/images/logos/logo-big.png';
$file = $client->uploadFile('container-name', $localFile, $remotePath);
 php
$containerName = 'container-name';
// container-specific secret key
$client->setObjectSecretKey($containerName, 'myContainerSecretKey');
// or account-wide secret key
$client->setObjectSecretKey('/', 'myAccountSecretKey');
 php
$remotePath = '/container-name/private-files/account.txt';
$expires = time() + (60 * 60); // expires in 1 hour
$secretKey = 'myAccountSecretKey'; // account or container secret key
$signedUrl = $client->generateSignedLink($remotePath, $expires, $secretKey);