Download the PHP package samsonos/php_fs without Composer
On this page you can find all versions of the php package samsonos/php_fs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samsonos/php_fs
More information about samsonos/php_fs
Files in samsonos/php_fs
Package php_fs
Short Description SamsonPHP file system service
License Open Software License (OSL) v 3.0
Homepage http://samsonos.com/
Informations about the package php_fs
SamsonPHP File service
This module gives abstraction level for working with file system independently of what exact file system is being used.
Configuration
The main goal is to configure the service parameter.
This is usually done using SamsonPHP module/service configuration
By default is set to - it uses standard local file system service which is implemented by SamsonPHP local file service . This parameter has to be set to file service class name, for example - local file service - , no module/service identifiers or anything else should be used, first namespace separator should be avoided too:
-
- incorrect
-
- correct
When service is initialized it checks if configured file service class is present otherwise fatal error is signaled.
This gives you ability, for example, to quickly change your web-application file system from local file system to Amazon Web Services S3 bucket, which is implemented by SamsonPHP AWS file service . All you have to do is add configuration for this SamsonPHP file service():
Usage
To work with this SamsonPHP file service you should get file service instance pointer:
After this you can use all available methods from interface, which this SamsonPHP file service() implements. All this method call act like a proxy and passes them to currently configured file service(by default ).
Example usage:
Using service in tests
First of all you should create service instance:
In other places called after service creation you should retrieve service object via factory method:
All other SamsonPHP modules must and use this file service approach when working with files.