burzum/storage-factory

This package is abandoned and no longer maintained. No replacement package was suggested.

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.

1.0.0-alpha1 2016-01-17 21:57 UTC

This package is auto-updated.

Last update: 2021-01-19 18:54:29 UTC


README

Software License Build Status Coverage Status

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.

License

Copyright 2012 - 2015, Florian Krämer

Licensed under The MIT License Redistributions of files must retain the above copyright notice.