Awesome
Yii2 Flysystem
yii2-flysystem
Installation
The preferred way to install this extension is through composer.
php composer.phar require --prefer-dist kriss/yii2-flysystem
config
return [
'components' => [
// others
'storage' => [
'class' => \kriss\storage\Storage::class,
'adapter' => function () {
return new \League\Flysystem\Adapter\Local(Yii::getAlias('@webroot/files'));
}
],
]
]
usage
use kriss\storage\Storage;
use Yii;
/** @var Storage $storage */
$storage = Yii::$app->get('storage');
$fileSystem = $storage->getFileSystem();
$adapter = $storage->getAdapter();
// or
$adapter = $storage->getFileSystem()->getAdapter();