Download the PHP package slivka-b/selectel-cloud-storage without Composer
On this page you can find all versions of the php package slivka-b/selectel-cloud-storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download slivka-b/selectel-cloud-storage
More information about slivka-b/selectel-cloud-storage
Files in slivka-b/selectel-cloud-storage
Package selectel-cloud-storage
Short Description Selectel Cloud Storage API
License MIT
Homepage https://github.com/argentcrusade/selectel-cloud-storage
Informations about the package selectel-cloud-storage
argentcrusade/selectel-cloud-storage
Unofficial PHP SDK for Selectel Cloud Storage API.
Requirements
This package requires PHP 5.6 or higher.
Installation
You can install the package via composer:
Usage
Initialize Storage
CloudStorage
ArgentCrusade\Selectel\CloudStorage\CloudStorage class allows you to access and create containers.
Containers Collection
CloudStorage::containers method returns instance of ArgentCrusade\Selectel\CloudStorage\Collections\Collection class with retrieved containers objects. This collection object implements ArrayAccess, Countable, Iterator and JsonSerializable interfaces, what makes you able to do these things:
Container Instance
Container that you've retrieved from Containers Collection is an ArgentCrusade\Selectel\CloudStorage\Container instance object which implements Countable and JsonSerializable interfaces.
Fluent Files Loader
You can use instance of ArgentCrusade\Selectel\CloudStorage\FluentFilesLoader class to retrieve files from container.
Fluent loader returns Collection of file arrays or Collection of File objects.
This instance is accesible from $container->files() method and allows you to do following things:
If you need to create FluentFilesLoader instance without Container instance, use following code:
File Uploads
Container class provides uploadFromString method to upload file contents and uploadFromStream method to upload file from stream.
Both methods accepts array $params as third optional argument.
Also, uploadFromString method accepts 4th argument bool $verifyChecksum. If true, Selectel will perform MD5 checksum comparison and if something went wrong during upload process, it won't accept file and exception will be thrown. This option is enabled by default for uploadFromString method.
File Instance
When you retrieve collection of files via Contrainer::files method you get Collection of file arrays:
But when you're using Container::files()->find method, you receive instance of ArgentCrusade\Selectel\CloudStorage\File class that implements JsonSerializable interface. With this object you can perform operations such as renaming, copying and deleting file.
If you need to transform file from array to File instance you can use Container::getFileFromArray method:
Also, you can use Container::getFilesCollectionFromArrays method to convert files Collection or array of file arrays to Collection of File instances:
Fluent loader (FluentFilesLoader) can also return Collection of file objects by calling asFileObjects method before get method (see Fluent Files Loader section).
Warning: converting a lot of files to File instances may result in performance loss.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
