Copy an object
static
mixed
copyObject
( $srcBucket, $srcUri, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [array $requestHeaders = array()])
-
string
$bucket: Destination bucket name
-
string
$uri: Destination object URI
-
constant
$acl: ACL constant
-
array
$metaHeaders: Optional array of x-amz-meta-* headers
-
array
$requestHeaders: Optional array of request headers (content type, disposition, etc.)
-
$srcBucket
-
$srcUri
Create a CloudFront distribution
static
array
createDistribution
(string $bucket, [boolean $enabled = true], [array $cnames = array()], [string $comment = ''])
-
string
$bucket: Bucket name
-
boolean
$enabled: Enabled (true/false)
-
array
$cnames: Array containing CNAME aliases
-
string
$comment: Use the bucket name as the hostname
Delete an empty bucket
static
boolean
deleteBucket
(string $bucket)
-
string
$bucket: Bucket name
Delete a CloudFront distribution
static
boolean
deleteDistribution
(array $dist)
-
array
$dist: Distribution array info identical to output of getDistribution()
Delete an object
static
boolean
deleteObject
(string $bucket, string $uri)
-
string
$bucket: Bucket name
-
string
$uri: Object URI
Disable bucket logging
static
boolean
disableBucketLogging
(string $bucket)
-
string
$bucket: Bucket name
Get object or bucket Access Control Policy
static
mixed
getAccessControlPolicy
(string $bucket, [string $uri = ''])
-
string
$bucket: Bucket name
-
string
$uri: Object URI
Get a query string authenticated URL
static
string
getAuthenticatedURL
(string $bucket, string $uri, integer $lifetime, [boolean $hostBucket = false], [boolean $https = false])
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
integer
$lifetime: Lifetime in seconds
-
boolean
$hostBucket: Use the bucket name as the hostname
-
boolean
$https: Use HTTPS ($hostBucket should be false for SSL verification)
static
void
getBucket
( $bucket, [ $prefix = null], [ $marker = null], [ $maxKeys = null], [ $delimiter = null], [ $returnCommonPrefixes = false])
-
$bucket
-
$prefix
-
$marker
-
$maxKeys
-
$delimiter
-
$returnCommonPrefixes
Get a bucket's location
static
string
getBucketLocation
(string $bucket)
-
string
$bucket: Bucket name
Get logging status for a bucket
This will return false if logging is not enabled. Note: To enable logging, you also need to grant write access to the log group
static
array
getBucketLogging
(string $bucket)
-
string
$bucket: Bucket name
Get CloudFront distribution info
static
array
getDistribution
(string $distributionId)
-
string
$distributionId: Distribution ID from listDistributions()
Get upload POST parameters for form uploads
static
object
getHttpUploadPostParams
(string $bucket, [string $uriPrefix = ''], [constant $acl = self::ACL_PRIVATE], [integer $lifetime = 3600], [integer $maxFileSize = 5242880], [string $successRedirect = "201"], [array $amzHeaders = array()], [array $headers = array()], [boolean $flashVars = false])
-
string
$bucket: Bucket name
-
string
$uriPrefix: Object URI prefix
-
constant
$acl: ACL constant
-
integer
$lifetime: Lifetime in seconds
-
integer
$maxFileSize: Maximum filesize in bytes (default 5MB)
-
string
$successRedirect: Redirect URL or 200 / 201 status code
-
array
$amzHeaders: Array of x-amz-meta-* headers
-
array
$headers: Array of request headers or content type as a string
-
boolean
$flashVars: Includes additional "Filename" variable posted by Flash
Get an object
static
mixed
getObject
(string $bucket, string $uri, [mixed $saveTo = false])
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
mixed
$saveTo: Filename or resource to write to
Get object information
static
mixed
getObjectInfo
(string $bucket, string $uri, [boolean $returnInfo = true])
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
boolean
$returnInfo: Return response information
Create input info array for putObject()
static
array
inputFile
(string $file, [mixed $md5sum = true])
-
string
$file: Input file
-
mixed
$md5sum: Use MD5 hash (supply a string if you want to use your own)
Create input array info for putObject() with a resource
static
array
inputResource
( &$resource, integer $bufferSize, [string $md5sum = ''], string $resource)
-
string
$resource: Input resource to read from
-
integer
$bufferSize: Input byte size
-
string
$md5sum: MD5 hash to send (optional)
-
&$resource
Get a list of buckets
static
array
listBuckets
([boolean $detailed = false])
-
boolean
$detailed: Returns detailed bucket list when true
Get a list of CloudFront distributions
static
array
listDistributions
()
Put a bucket
static
boolean
putBucket
(string $bucket, [constant $acl = self::ACL_PRIVATE], [string $location = false])
-
string
$bucket: Bucket name
-
constant
$acl: ACL flag
-
string
$location: Set as "EU" to create buckets hosted in Europe
Put an object
static
boolean
putObject
(mixed $input, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [array $requestHeaders = array()])
-
mixed
$input: Input data
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
constant
$acl: ACL constant
-
array
$metaHeaders: Array of x-amz-meta-* headers
-
array
$requestHeaders: Array of request headers or content type as a string
Put an object from a file (legacy function)
static
boolean
putObjectFile
(string $file, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [string $contentType = null])
-
string
$file: Input file path
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
constant
$acl: ACL constant
-
array
$metaHeaders: Array of x-amz-meta-* headers
-
string
$contentType: Content type
Put an object from a string (legacy function)
static
boolean
putObjectString
(string $string, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [string $contentType = 'text/plain'])
-
string
$string: Input data
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
constant
$acl: ACL constant
-
array
$metaHeaders: Array of x-amz-meta-* headers
-
string
$contentType: Content type
Set object or bucket Access Control Policy
static
boolean
setAccessControlPolicy
(string $bucket, [string $uri = ''], [array $acp = array()])
-
string
$bucket: Bucket name
-
string
$uri: Object URI
-
array
$acp: Access Control Policy Data (same as the data returned from getAccessControlPolicy)
Set AWS access key and secret key
static
void
setAuth
(string $accessKey, string $secretKey)
-
string
$accessKey: Access key
-
string
$secretKey: Secret key
Set logging for a bucket
static
boolean
setBucketLogging
(string $bucket, string $targetBucket, [string $targetPrefix = null])
-
string
$bucket: Bucket name
-
string
$targetBucket: Target bucket (where logs are stored)
-
string
$targetPrefix: Log prefix (e,g; domain.com-)
Update a CloudFront distribution
static
array
updateDistribution
(array $dist)
-
array
$dist: Distribution array info identical to output of getDistribution()
Get MIME type for file
static
string
__getMimeType
(string &$file)
Generate the auth string: "AWS AccessKey:Signature"
static
string
__getSignature
(string $string)
-
string
$string: String to sign
Constructor - if you're not using the class statically
void
__construct
([string $accessKey = null], [string $secretKey = null], [boolean $useSSL = true])
-
string
$accessKey: Access key
-
string
$secretKey: Secret key
-
boolean
$useSSL: Enable SSL