2017 © Pedro Peláez
 

yii-extension resource-manager

Resource manager eases your project resources management.

image

2amigos/resource-manager

Resource manager eases your project resources management.

  • Friday, January 8, 2016
  • by tonydspaniard
  • Repository
  • 4 Watchers
  • 5 Stars
  • 206 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Resource manager extension for Yii 1

This extension allows you to manage resources. Currently supports two possible scenarios:, (*1)

  • 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., (*2)

Either run, (*3)

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

or add, (*4)

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

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

Configuring

Once the extension is installed, simply modify your application configuration as follows:, (*6)

return array(
    'components' => array(
        'resourceManager' => 'EAmazonS3ResourceManager',
        'key' => 'YOUR-AWS-ACCESS-KEY-HERE',
        'secret' => 'YOUR-AWS-ACCESS-SECRET-HERE',
        'bucket' => 'YOUR-AWS-BUCKET-NAME-HERE',
        'region' => 'AWS-REGION-NAME-HERE',
    ),
);

Done. Now you can use our component to save some data to the Amazon S3 storage., (*7)

Usage

Here's possible code of your view:, (*8)

<?php echo CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data')); ?>
    <?php echo CHtml::fileField('user-photo'); ?>
    <?php echo CHtml::submitButton('Upload new image'); ?>
<?php echo CHtml::endForm(); ?>

And this is how could look your controller code for processing the uploaded file:, (*9)

$userPhoto = CUploadedFile::getInstanceByName('user-photo');
if ($userPhoto !== null) {
    if (!Yii::app()->getComponent('resourceManager')->saveFile($userPhoto, $userPhoto->getName())) {
        throw new CHttpException(500, 'Sorry, unable to upload your profile photo.');
    }
    Yii::app()->getUser()->setFlash('userPhotoUpdated', 'Great, your profile photo has been updated!');
    $this->refresh();
}
$this->render('userPhotoForm');

Notes

Looking for a version for the Yii 2? There is a dedicated repository for it: 2amigos/yii2-resource-manager-component., (*10)

2amigOS! Web development has never been so fun! www.2amigos.us, (*11)

The Versions

08/01 2016

dev-master

9999999-dev https://github.com/2amigos/resource-manager

Resource manager eases your project resources management.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kochetov

component extension amazon s3 aws yii resource

08/01 2016

1.0.3

1.0.3.0 https://github.com/2amigos/resource-manager

Resource manager eases your project resources management.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kochetov

component extension amazon s3 aws yii resource

19/02 2014

0.2

0.2.0.0 https://github.com/2amigos/resource-manager

Resource manager eases your project resources management.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kochetov

component extension amazon s3 aws yii resource

19/02 2014

0.1

0.1.0.0 https://github.com/2amigos/resource-manager

Resource manager eases your project resources management.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kochetov

component extension amazon s3 aws yii resource