treinetic / remote-storage
Remote storage service client
v0.1
2018-03-19 12:39 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: 5.4
This package is not auto-updated.
Last update: 2024-12-08 06:42:45 UTC
README
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
Installing
composer require treinetic/remote-storage
Usage
Initialization
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);
Make Directory
$storageClient->makeDirectory("dirName");
Store files
$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
Get Files
$response = $storageClient->get('user/profile/my.jpg'); file_put_contents('img.jpg', $response);
Copy Files
$storageClient->copy('user/profile/my.jpg', 'user/profile/copy.jpg');
- 1st parameter is the source file
- 2nd parameter is the destination file
Move Files
$storageClient->move('user/profile/my.jpg', 'user/profile/move.jpg');
- 1st parameter is the source file
- 2nd parameter is the destination file
Check if exists
$result = $storageClient->exists('user/profile/my.jpg'); var_dump($result); // true or false
Delete Files
$storageClient->delete('user/profile/my.jpg');