Using Amazon S3 with your PHP Apps

Published 01/07/2009 at 4:53 PM, updated 01/07/2009 at 4:53 PM (GMT)

There is a neat little PHP 5 class written by Donovan Schönknecht that allows you to access and manage both your Amazon S3 and CloudFront distributions right from your PHP scripts, allowing distributed file access without the need for manual intervention.

I know it's how the service is meant to be accessed in the first place, and this script is one of the better additions to the growing number of S3 access methods popping up over the internet.

To use it on a basic level:

require_once 'S3.php';
$s3 = new S3('accessKey','secretKey');
$s3->putObjectFile('test.txt','bucket','test.txt',S3::ACL_PUBLIC_READ);

(Assuming text.txt is a file in the same directory as that script, along with the class.)

Neat and fast :)

Add a Comment

Comment (No HTML, URIs are automagically made clickable)