Download the PHP package phossa2/storage without Composer
On this page you can find all versions of the php package phossa2/storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phossa2/storage
More information about phossa2/storage
Files in phossa2/storage
Package storage
Short Description A storage front for local or remote storage system
License MIT
Homepage https://github.com/phossa2/storage
Informations about the package storage
phossa2/storage
phossa2/storage is a PHP storage library with support for local or cloud storage.
It requires PHP 5.4, supports PHP 7.0+ and HHVM. It is compliant with PSR-1, PSR-2, PSR-3, PSR-4, and the proposed PSR-5.
Installation
Install via the composer
utility.
or add the following lines to your composer.json
Introduction
-
Simple restful like APIs.
-
Unified path syntax like
/local/img/avatar.jpg
for all systems. -
Mounting and umounting
filesystem
. -
Support for different drivers.
- Support for stream.
Usage
Create the storage instance,
Features
-
Support for simple and instinctive APIs like
get()
,put()
,has()
anddel()
etc.Others APIs like
meta()
Get the meta data of the file
copy()
andmove()
Copy or move files in or between filesystems
-
Uses unified path syntax like `/local/dir/file.txt' for all systems including windows. The underlying driver is responsible for translating path transparently.
-
Mounting and umounting filesystems
filesytem
is a wrapper of different drivers with permissions. User may mount a read only filesystem as follows,Different filesystem may use same driver,
Filesystems may overlapping on top of others,
-
Support for different drivers inlucing local or cloud storage.
-
Write and read streams as follows,
APIs
-
bool has(string $path)
check
$path
existens.null|string|array|resource get(string $path, bool $getAsStream)
Get content of the
$path
.-
If not found or failure, returns
NULL
. -
If
$path
is a directory, returns an array of the full paths of the files under this$path
. -
If
$getAsStream
istrue
, returns a stream handler. bool put(string $path, string|resource|null $content, array $meta = [])
Set the content or meta data of the
$path
.bool del(string $path)
Remove the
$path
. If$path
is a directory, will remove all files under this path and the path itself (unless it is a mount point).bool copy(string $from, string $to)
andbool copy(string $from, string $to)
Copy or move
$from
to$to
.array meta(string $path)
Get the meta data of
$path
. If not found or error, returns[]
.Phossa2\Storage\Path path(string $path)
Returns a
Phossa2\Storage\Path
object -
bool hasError()
Has error ?
string getError()
Get previous error message. If no error, returns
''
.string getErrorCode()
Get a numeric string of the error code.
Change log
Please see CHANGELOG from more information.
Contributing
Please see CONTRIBUTE for more information.
Dependencies
-
PHP >= 5.4.0
- phossa2/shared >= 2.0.23