A standalone Amazon S3 (REST) client for PHP 5.2.x using CURL that does not require PEAR.

v0.5.1 2015-04-27 06:12 UTC

This package is not auto-updated.

Last update: 2023-01-16 19:29:39 UTC



OO method (e,g; $s3->getObject(...)):

$s3 = new S3($awsAccessKey, $awsSecretKey);

Statically (e,g; S3::getObject(...)):

S3::setAuth($awsAccessKey, $awsSecretKey);

Object Operations

Uploading objects

Put an object from a file:

S3::putObject(S3::inputFile($file, false), $bucketName, $uploadName, S3::ACL_PUBLIC_READ)

Put an object from a string and set its Content-Type:

S3::putObject($string, $bucketName, $uploadName, S3::ACL_PUBLIC_READ, array(), array('Content-Type' => 'text/plain'))

Put an object from a resource (buffer/file size is required - note: the resource will be fclose()'d automatically):

S3::putObject(S3::inputResource(fopen($file, 'rb'), filesize($file)), $bucketName, $uploadName, S3::ACL_PUBLIC_READ)

Retrieving objects

Get an object:

S3::getObject($bucketName, $uploadName)

Save an object to file:

S3::getObject($bucketName, $uploadName, $saveName)

Save an object to a resource of any type:

S3::getObject($bucketName, $uploadName, fopen('savefile.txt', 'wb'))

Copying and deleting objects

Copy an object:

S3::copyObject($srcBucket, $srcName, $bucketName, $saveName, $metaHeaders = array(), $requestHeaders = array())

Delete an object:

S3::deleteObject($bucketName, $uploadName)

Bucket Operations

Get a list of buckets:

S3::listBuckets()  // Simple bucket list
S3::listBuckets(true)  // Detailed bucket list

Create a bucket:


Get the contents of a bucket:


Delete an empty bucket: