burzum / storage-factory
This library is a factory to instantiate storage adapters based on the Flysystem or Gaufrette library. It can deal with both! Migrating from one lib to another should be easy this way.
Installs: 11 893
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Requires
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2021-01-19 18:54:29 UTC
README
Requirements
- PHP 5.4+
At least one of both:
- Gaufrette Library
- Flysystem Library
How to use it
Configure the adapter instances:
$basePath = '/your/base/path'; StorageFactory::config('LocalGaufrette', array( 'adapterOptions' => [$basePath, true], 'adapterClass' => '\Gaufrette\Adapter\Local', 'class' => '\Gaufrette\Filesystem' )); StorageFactory::config('LocalFlysystem', array( 'adapterOptions' => [$basePath], 'engine' => StorageFactory::FLYSYSTEM_ENGINE, 'adapterClass' => 'Local', ));
And get instances of the adapters as you need them.
$flysystemLocalFSAdapter = StorageFactory::get('LocalGaufrette'); $gaufretteLocalFSAdapter = StorageFactory::get('LocalFlysystem');
Flush or renews adapter objects:
// Flushes a specific adapter based on the config name StorageFactory::flush('LocalGaufrette'); // Flushes ALL adapters StorageFactory::flush(); // Renews an adapter, set second arg to true StorageFactory::get('LocalGaufrette', true);
Support
For bugs and feature requests, please use the issues section of this repository.
Contributing
To contribute to this repository please follow a few basic rules.
- Pull requests must be send to the
develop
branch. - Contributions must follow the PSR2 coding standard recommendation.
- Unit tests are required.
License
Copyright 2012 - 2015, Florian Krämer
Licensed under The MIT License Redistributions of files must retain the above copyright notice.