定制 2amigos/yii2-resource-manager-component 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

2amigos/yii2-resource-manager-component

最新稳定版本:0.1.0

Composer 安装命令:

composer require 2amigos/yii2-resource-manager-component

包简介

Resource manager eases your project resources management.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

This extension allows you to manage resources. Currently supports two possible scenarios:

  • Resources to save/or saved on a server's folder
  • Resources to save/or saved on an Amazon S3 bucket

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require 2amigos/yii2-resource-manager-component "*"

or add

"2amigos/yii2-resource-manager-component": "*"

to the require section of your composer.json file.

Configuring

Configure the selected component on your configuration file as follows:

// For this example we using AmazonS3ResourceManager component
// ...
'components' => [  
	// ...   
	'resourceManager' => [
	'class' => 'dosamigos\resourcemanager\AmazonS3ResourceManager',
		'key' => 'YOUR-AWS-KEY-HERE',
		'secret' => 'YOUR-AWS-SECRET-HERE',
		'bucket' => 'YOUR-AWS-BUCKET-NAME-HERE'
	]
	// ...
]
// ...  

Done... Now, to save a resource to AWS S3 server, we just need to do the following:

// Defensive code checks not written for the example
$resource = yii\web\UploadedFile::getInstanceByName('instance-name');
$name = md5($resource->name) . '.' . $resource->getExtension();
if(\Yii::$app->resourceManager->save($resource, $name)) {
    echo 'Done...';
}

Notes

Looking for a version for the Yii 1.1? There is dedicated repository for it: 2amigos/resource-manager.

2amigOS!
Web development has never been so fun!
www.2amigos.us

统计信息

  • 总下载量: 23.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 36
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 35
  • Watchers: 19
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-02-03