PHP code example of fhteam / selectel-storage-api

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

    

fhteam / selectel-storage-api example snippets


    $config = r = new Container($config['auth_container']);

    $auth = new CredentialsAuthentication($config['auth_user'], $config['auth_key'], $config['auth_url']);
    $auth->authenticate();

    $file = new File('test.txt');
    $file->setLocalName(__DIR__ . '/../data/config.php');
    $file->setSize();

    $service = new StorageService($auth);
    $service->uploadFile($container, $file);

    $file = new File('test.txt');
    $service = new StorageService($auth);
    $service->deleteFile($container, $file);