2017 © Pedro Peláez
 

yii2-extension yii2-storage

The storage extension for Yii2.

image

yiizh/yii2-storage

The storage extension for Yii2.

  • Friday, November 27, 2015
  • by zhangdi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,913 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 12 % Grown

The README.md

The storage extension for Yii2.

This extension provides support for multi storage., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist yiizh/yii2-storage "dev-master"

or add, (*4)

"yiizh/yii2-storage": "*"

to the require section of your composer.json file., (*5)

Usage

Change config file :, (*6)

Config

For local storage

...
    'components' => [
        'storage' => [
            'class'=>'\yiizh\storage\LocalStorage',
            'basePath' => '@app/web/uploads'
        ]
    ]
...

For Aliyun storage

...
    'components' => [
        'storage' => [
            'class' => '\yiizh\storage\AliyunStorage',
            'accessKey' => '<您从OSS获得的AccessKeyId>',
            'accessSecret' => '<您从OSS获得的AccessKeySecret>',
            'endpoint' => '<您选定的OSS数据中心访问域名,例如oss-cn-hangzhou.aliyuncs.com>',
            'bucket' => '<您的绑定在某个Bucket上的自定义域名>',
        ]
    ]
...

Upload File

\Yii::$app->storage->save('文件名', '文件内容');

The Versions

27/11 2015

dev-master

9999999-dev https://github.com/yiizh/yii2-storage

The storage extension for Yii2.

  Sources   Download

MIT

The Requires

 

by Di.Zhang

extension yii2 storage