Yii-Aws Extension


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:






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(




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.

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!