Treinetic remote storage (TRS) is a highly available cloud storage services. We provide 99.9% up time and multi regional backups. TRS provide sophisticated security compliances and it is optimized for high speed data delivery. For more details contact us via info@treinetic.com
composer require treinetic/remote-storage
Import StorageClient into your .php file
use Treinetic\RStorage\StorageClient;
Then initialize the StorageClient
. StorageClient
's constructor accept 3 arguments.
URL
endpoint of the remote serveraccessKey
enpoint access keysecretKey
enpoint secret key
$storageClient = new \Treinetic\RStorage\StorageClient($server,
$accessKey,
$secretKey);
$storageClient->makeDirectory("dirName");
$storageClient->put('./test/img.jpg', 'user/profile', 'my.jpg');
- 1st parameeter is the local file path
- 2nd parameter is the remote directory. (It will create a directory if not exists)
- 3rd prarameter is the file name for remote file
$response = $storageClient->get('user/profile/my.jpg');
file_put_contents('img.jpg', $response);
$storageClient->copy('user/profile/my.jpg', 'user/profile/copy.jpg');
- 1st parameter is the source file
- 2nd parameter is the destination file
$storageClient->move('user/profile/my.jpg', 'user/profile/move.jpg');
- 1st parameter is the source file
- 2nd parameter is the destination file
$result = $storageClient->exists('user/profile/my.jpg');
var_dump($result); // true or false
$storageClient->delete('user/profile/my.jpg');