axelpal / selectel-storage
Selectel Storage API php wrapper
2.0.2
2021-07-02 08:49 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
README
composer.json
"require": { "axelpal/selectel-storage": "~2.0", }
<?php require_once("vendor/autoload.php"); $selectelStorage = new axelpal\selectel\storage\SelectelStorage("user", "pass");
Create Container
$container = $selectelStorage->createContainer('selectel', array("X-Container-Meta-Type: public")); // get container info $container->getInfo();
Containers list
$containerList = $selectelStorage->listContainers();
Create directory
$container->createDirectory('php/test');
List
$dirList = $container->listFiles($limit = 10000, $marker = null, $prefix = null, $path = ""); // files $fileList = $container->listFiles($limit = 10000, $marker = null, $prefix = null, $path = 'php/');
Put File
$res = $container->putFile(__FILE__, 'example.php',["Content-Type: text/html"]);
File info
$fileInfo = $container->getFileInfo('example.php');
Get file
$file = $container->getFile($fileList[0]);
Copy file
$copyRes = $container->copy('example.php', 'php/test/Examples_copy.php');
Create link
$copyRes = $container->createLink('links/example.php', 'example.php');
Delete
$deleteRes = $container->delete('example.php');
Passing Timeout to request
$format = null; $timeoutInMilliseconds = 5000; $selectelStorage = new axelpal\selectel\storage\SelectelStorage("user", "pass", $format, $timeoutInMilliseconds);