Yii Framework Forum: Yii-Aws Extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Aws Extension Rate Topic: -----

#1 User is offline   Frédéric Gascon 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-November 10

Posted 29 November 2012 - 03:44 PM

Hi,

I developped an extension to wrap the latest AWS SDK. The extension is hosted on my GitHub account (github.com/fgascon/yii-aws).

It currently only support S3 and SES, but I hope to cover every Amazon services.

To install the extension you need to download the AWS SDK and put it in a vendor folder. You then specify this folder's path using the VENDORS_PATH contant.

After that you just have to include the extension in your config file like this:
'aws'=>array(
	'class'=>'ext.yii-aws.EAWS',
	'accessKey'=>'YOUR_ACCESS_KEY',
	'secretKey'=>'YOUR_SECRET_KEY',
),


Note: I will change the SDK integration to allow a more flexible setting in the near future. I only put it that way because I have projects that use a VENDORS_PATH constant.

The extension can be used like this:
$bucket = Yii::app()->aws->s3->getBucket('YOUR_BUCKET_NAME');
$uploadedFile = CUploadedFile::getInstanceByName('file');
$bucket->createObject($uploadedFile->name, array(
	'fileUpload'=>$uploadedFile->tempName,
	'acl'=>'public-read',
));


As you can see the bucket is specified in the request wich allow you to use multiple buckets in one application.

In real projects I often get the bucket that way:
$bucket = Yii::app()->aws->s3->getBucket(Yii::app()->params['imageBucket']);

That way I can have different buckets in developpment and production.
0

#2 User is offline   landland 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 29-October 12

Posted 18 February 2013 - 05:35 PM

I have been using your extension with great success, so thank you. It works in my application but I am getting an error if I try to run it from the command line. Wondering if you have any resolution. Here is the error.

CException' with message 'Property "CConsoleApplication.aws" is not defined.' in /var/app/current/protected/framework/base/CComponent.php:131

Nevermind: Just needed to include it in console components, which I thought I had done but did not. Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users