Giter Club home page Giter Club logo

yii2-resource-manager-component's Introduction

Resource Manager component for Yii 2

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

yii2-resource-manager-component's People

Contributors

creocoder avatar resurtm avatar slavcodev avatar tarikuzunkaya07 avatar tonydspaniard avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.