burzum/storage-factory

此包已被弃用且不再维护。未建议替换包。

此库是一个基于Flysystem或Gaufrette库的存储适配器实例化工厂。它可以处理两者!通过这种方式从库迁移到另一个库应该很简单。

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

要求

  • PHP 5.4+

至少其中一个

  • Gaufrette 库
  • Flysystem 库

如何使用

配置适配器实例

$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',
));

并根据需要获取适配器实例。

$flysystemLocalFSAdapter = StorageFactory::get('LocalGaufrette');
$gaufretteLocalFSAdapter = StorageFactory::get('LocalFlysystem');

刷新或更新适配器对象

// 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);

支持

对于错误和功能请求,请使用此存储库的问题部分。

贡献

要为此存储库做出贡献,请遵循以下一些基本规则。

许可证

版权所有 2012 - 2015, Florian Krämer

许可协议:The MIT License。文件再分发时必须保留上述版权声明。