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.