kriss/yii2-flysystem

yii2-flysystem

Installs: 174

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.1 2018-10-16 03:53 UTC

This package is auto-updated.

Last update: 2024-11-16 20:01:26 UTC


README

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

more Info

flysystem

fileSystem API

Commonly-Used Adapters

Aliyun OSS Adapter

QiNiu Adapter