2017 © Pedro Peláez
 

cakephp-plugin cakephp-amazon-s3

Cakephp Amazon S3 - Composer version for robmcvey/cakephp-amazon-s3

image

tabenguyen/cakephp-amazon-s3

Cakephp Amazon S3 - Composer version for robmcvey/cakephp-amazon-s3

  • Thursday, November 6, 2014
  • by tabenguyen
  • Repository
  • 2 Watchers
  • 3 Stars
  • 683 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Amazon S3 Plugin for CakePHP 2.x

A CakePHP Plugin to interact with Amazon Web Services S3 objects. This plugin provides a simple and robust methods that can be added to any CakePHP project to complete the following:, (*1)

  • Retrieve a remote file from an S3 bucket and save locally
  • Save a local file in an S3 bucket
  • Delete a file in an S3 bucket

Requirements

  • CakePHP 2.x
  • An Amazon Web Services account (http://aws.amazon.com/s3/)
  • Your AWS access key and secret key

Installation

[Composer], (*2)

required: "tabenguyen/cakephp-amazon-s3": "dev-master"

Usuage examples

Remember to add CakePlugin::load('CakephpAmazonS3'); to your app's bootstrap file., (*3)

Then, simply initialise the plugin with your AWS Access key, secret key and the bucket name you wish to work with., (*4)

App::uses('AmazonS3', 'CakephpAmazonS3.Lib');
$AmazonS3 = new AmazonS3(array('{access key}', '{secret key}', '{bucket name}'));

GET

The get method retrieves a remote file and saves it locally. So let's say there is the file foo.jpg on S3 and you want to save it locally in /home/me/stuff/photos you'd use the following., (*5)

$AmazonS3->get('foo.jpg' , '/home/me/stuff/photos');

PUT

The put method does the reverse of get, and saves a local file to S3., (*6)

$AmazonS3->put('/home/me/stuff/photos/foo.jpg');

You can optionally specifiy a remote directory within the bucket to save the file in., (*7)

$AmazonS3->put('/home/me/stuff/photos/foo.jpg' , 'some/folder');

To add any additional AWS headers to a put, example to set the file as "public", they can be passed as an array to the amazonHeaders property., (*8)

$AmazonS3->amazonHeaders = array(
    'x-amz-acl' => 'public-read',
    'X-Amz-Meta-ReviewedBy' => 'john.doe@yahoo.biz'
);
$AmazonS3->put('/home/me/stuff/photos/foo.jpg' , 'some/folder');

DELETE

Deletes a file from S3., (*9)

$AmazonS3->delete('foo.jpg');

Or delete from within a directory in the bucket:, (*10)

$AmazonS3->delete('/some/folder/foo.jpg');

The Versions

06/11 2014

dev-master

9999999-dev

Cakephp Amazon S3 - Composer version for robmcvey/cakephp-amazon-s3

  Sources   Download

MIT

The Requires

 

acl cakephp