mhunesi/yii2-storage
最新稳定版本:v2.0.0
Composer 安装命令:
composer require mhunesi/yii2-storage
包简介
File Storage Abstraction for Yii2
关键字:
README 文档
README
File Storage Component for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mhunesi/yii2-storage "*"
or add
"mhunesi/yii2-storage": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
'components' => [ //... 'storage' => [ 'class' => '\mhunesi\storage\Storage', 'defaultStorage' => 'local', 'queueFilters' => true, 'queueFiltersList' => ['tiny-crop', 'medium-thumbnail'], 'downloadValidationKey' => 'YII_STORAGE_KEY', 'downloadUrl' => '/site/download', 'storages' => [ 'local' => [ 'class' => '\mhunesi\storage\filesystem\LocalFilesystem', 'path' => '@app/web/uploads' ], 'aws' => [ 'class' => 'mhunesi\storage\filesystem\AwsS3Filesystem', 'bucket' => 'bucket_name', 'key' => '_key', 'secret' => 'secret_key', 'region' => 'eu-central-1', // 'version' => 'latest', 'prefix' => 'wss', ], 'minio' => [ 'class' => 'mhunesi\storage\filesystem\AwsS3Filesystem', 'bucket' => 'bucket_name', 'key' => '_key', 'secret' => 'scret_key', 'region' => 'eu-central-1', // 'version' => 'latest', // 'baseUrl' => 'your-base-url', 'prefix' => 'subfolder', // 'options' => [], 'endpoint' => 'http://127.0.0.1:49160' ], 'ftp' => [ 'class' => 'mhunesi\storage\filesystem\FtpFilesystem', 'host' => '192.168.1.1', 'port' => 21, 'username' => 'ftp_username', 'password' => 'ftp_password', // 'ssl' => true, // 'timeout' => 60, 'root' => '/rootPath', 'publicUrl' => 'http://ftp_url/', // 'permPrivate' => 0700, // 'permPublic' => 0744, // 'passive' => false, // 'transferMode' => FTP_TEXT, ], ] ] //... ],
'controllerMap' => [ 'migrate' => [ //.. 'migrationNamespaces' => [ //.. ], 'migrationPath' => [ //.. '@mhunesi/storage/migrations' ] ] ],
Upload & Download Action
/** * {@inheritdoc} */ public function actions() { return [ 'download' => [ 'class' => 'mhunesi\storage\actions\DownloadAction', ], 'upload' => [ 'class' => 'mhunesi\storage\actions\FileUploadAction', 'use_strict' => true, 'path' => 'folder/folder', 'folder' => 1, 'hidden' => true, 'visibility' => 'public' // 'private' ], ]; }
URL Rules
'rules' => [ 'download/<token:[a-zA-Z0-9_\-\+\%\/=]*>/<filename:[a-zA-Z0-9_\-\+\%\.\ \/=]*>' => 'site/download' ]
统计信息
- 总下载量: 33
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-17