PHP code example of treinetic / remote-storage

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

    

treinetic / remote-storage example snippets


use Treinetic\RStorage\StorageClient;

$storageClient = new \Treinetic\RStorage\StorageClient($server,
                                                       $accessKey,
                                                       $secretKey);

$storageClient->makeDirectory("dirName");

$storageClient->put('./test/img.jpg', 'user/profile', 'my.jpg');

$response = $storageClient->get('user/profile/my.jpg');
file_put_contents('img.jpg', $response);

$storageClient->copy('user/profile/my.jpg', 'user/profile/copy.jpg');

$storageClient->move('user/profile/my.jpg', 'user/profile/move.jpg');

$result = $storageClient->exists('user/profile/my.jpg');
var_dump($result); // true or false

$storageClient->delete('user/profile/my.jpg');