Download the PHP package jaxon-php/jaxon-storage without Composer
On this page you can find all versions of the php package jaxon-php/jaxon-storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package jaxon-storage
File storage for the Jaxon library
This package provides a tiny wrapper for file storage for the Jaxon library using the PHP League Flysystem library.
Features
The library features are provided in the Jaxon\Storage\StorageManager class, which implements three functions.
Starting from version 1.1.0, a global function is available to get the instance of the storage manager.
This function creates and returns a static instance of the Jaxon\Storage\StorageManager class.
Register an adapter
This function registers an adapter from the Flysystem library.
The first parameter is the adapter id, and the second is a closure which takes a root dir and an optional array of options as parameters, and returns a League\Flysystem\FilesystemAdapter object configured for file input and output at the given location.
By default, the library registers an adapter for the local filesystem.
An adapter can be registered as an alias of an already registered one. This is useful for example for using the same adapter with different options.
Create a file input/output object
A Flysystem object for file input and output is created by chaining the adapter() and make() functions.
The adapter() function takes the id of a registered adapter as parameter, while the make() function takes the path to the root dir.
The code snippet below writes the given content in the /var/www/storage/uploads/uploaded-file.txt file.
The adapter and directory options can be passed to the adapter() and make() functions.
The adapter options are set on the adapter object (e.g LocalFilesystemAdapter), while the directory options are set on the returned Filesystem object. Their values are then described in their respective documentations.
Create a file input/output object from a Jaxon Config object
The Flysystem object for file input and output can also be created from option values in a Jaxon\Config\Config object.
For the storage with id uploads, the adapter, dir and options values will be read in the storage.stores.uploads entry.
The code snippet above writes the given content in the /var/www/storage/uploads/uploaded-file.txt file, as in the previous example.
Each adapter can also be defined as an alias of an already defined adapter.
Using without the Jaxon library
Starting from version 1.1.0, the Jaxon Storage classes do not depend on the jaxon-core classes anymore. As a consequence, some features will not be automatically available, and will need an extra setup.
The locale for translations
Without the jaxon-core library, the Jaxon Storage will create its own instance of the Jaxon\Utils\Translation\Translator class, which will then need to be set.
The storage config options
A call to the storage()->get() function will by default throw an exception due to missing config options.
The library then needs to be provided with a Jaxon\Config\Config object populated with the config options, or a closure which returns one, using the setConfig() method.
Register additional adapters
The Flysystem library provides adapters for many other filesystems, which can be registered with this library.
They are provided in separate packages, which need to be installed first.
AWS S3 file system adapter
Async AWS S3 file system adapter
Google Cloud file system adapter
Microsoft Azure file system adapter
FTP file system adapter
SFTP V2 file system adapter
SFTP V3 file system adapter
All versions of jaxon-storage with dependencies
jaxon-php/jaxon-config Version ^1.0
jaxon-php/jaxon-utils Version ^2.0
lagdo/facades Version ^1.0
league/flysystem Version ^3.0|^2.2
