public
|
#
__construct( string $accessKey = null, string $secretKey = null, boolean $useSSL = false, mixed $endpoint = 's3.amazonaws.com' )
Constructor - if you're not using the class statically
Constructor - if you're not using the class statically
Parameters
- $accessKey
string $accessKey Access key
- $secretKey
string $secretKey Secret key
- $useSSL
boolean $useSSL Enable SSL
- $endpoint
|
public
|
#
setEndpoint( string $host )
Set the sertvice endpoint
Set the sertvice endpoint
Parameters
- $host
string $host Hostname
|
public static
|
#
setAuth( string $accessKey, string $secretKey )
Set AWS access key and secret key
Set AWS access key and secret key
Parameters
- $accessKey
string $accessKey Access key
- $secretKey
string $secretKey Secret key
|
public static
boolean
|
#
hasAuth( )
Check if AWS keys have been set
Check if AWS keys have been set
Returns
boolean
|
public static
|
#
setSSL( boolean $enabled, boolean $validate = true )
Set SSL on or off
Parameters
- $enabled
boolean $enabled SSL enabled
- $validate
boolean $validate SSL certificate validation
|
public static
|
#
setSSLAuth( string $sslCert = null, string $sslKey = null, string $sslCACert = null )
Set SSL client certificates (experimental)
Set SSL client certificates (experimental)
Parameters
- $sslCert
string $sslCert SSL client certificate
- $sslKey
string $sslKey SSL client key
- $sslCACert
string $sslCACert SSL CA cert (only required if you are having problems with your
system CA cert)
|
public static
|
#
setProxy( string $host, string $user = null, string $pass = null, constant $type = CURLPROXY_SOCKS5 )
Set proxy information
Parameters
- $host
string $host Proxy hostname and port (localhost:1234)
- $user
string $user Proxy username
- $pass
string $pass Proxy password
- $type
constant $type CURL proxy type
|
public static
|
#
setExceptions( boolean $enabled = true )
Set the error mode to exceptions
Set the error mode to exceptions
Parameters
- $enabled
boolean $enabled Enable exceptions
|
public static
boolean
|
#
setSigningKey( string $keyPairId, string $signingKey, boolean $isFile = true )
Set signing key
Parameters
- $keyPairId
string $keyPairId AWS Key Pair ID
- $signingKey
string $signingKey Private Key
- $isFile
boolean $isFile Load private key from file, set to false to load string
Returns
boolean
|
public static
|
#
freeSigningKey( )
Free signing key from memory, MUST be called if you are using
setSigningKey()
Free signing key from memory, MUST be called if you are using
setSigningKey()
|
private static
|
#
__triggerError( string $message, string $file, integer $line, integer $code = 0 )
Internal error handler
Parameters
- $message
string $message Error message
- $file
string $file Filename
- $line
integer $line Line number
- $code
integer $code Error code
|
public static
array
|
#
listBuckets( boolean $detailed = false )
Get a list of buckets
Parameters
- $detailed
boolean $detailed Returns detailed bucket list when true
Returns
array | false
|
public static
|
#
getBucket( mixed $bucket, mixed $prefix = null, mixed $marker = null, mixed $maxKeys = null, mixed $delimiter = null, mixed $returnCommonPrefixes = false )
|
public static
boolean
|
#
putBucket( string $bucket, constant $acl = S3::ACL_PRIVATE , string $location = false )
Put a bucket
Parameters
- $bucket
string $bucket Bucket name
- $acl
constant $acl ACL flag
- $location
string $location Set as "EU" to create buckets hosted in Europe
Returns
boolean
|
public static
boolean
|
#
deleteBucket( string $bucket )
Delete an empty bucket
Parameters
- $bucket
string $bucket Bucket name
Returns
boolean
|
public static
array
|
#
inputFile( string $file, mixed $md5sum = true )
Create input info array for putObject()
Create input info array for putObject()
Parameters
- $file
string $file Input file
- $md5sum
mixed $md5sum Use MD5 hash (supply a string if you want to use your own)
Returns
array | false
|
public static
array
|
#
inputResource( string & $resource, integer $bufferSize, string $md5sum = '' )
Create input array info for putObject() with a resource
Create input array info for putObject() with a resource
Parameters
- $resource
string $resource Input resource to read from
- $bufferSize
integer $bufferSize Input byte size
- $md5sum
string $md5sum MD5 hash to send (optional)
Returns
array | false
|
public static
boolean
|
#
putObject( mixed $input, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE , array $metaHeaders = array(), array $requestHeaders = array(), constant $storageClass = S3::STORAGE_CLASS_STANDARD )
Put an object
Parameters
- $input
mixed $input Input data
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $acl
constant $acl ACL constant
- $metaHeaders
array $metaHeaders Array of x-amz-meta-* headers
- $requestHeaders
array $requestHeaders Array of request headers or content type as a string
- $storageClass
constant $storageClass Storage class constant
Returns
boolean
|
public static
boolean
|
#
putObjectFile( string $file, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE , array $metaHeaders = array(), string $contentType = null )
Put an object from a file (legacy function)
Put an object from a file (legacy function)
Parameters
- $file
string $file Input file path
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $acl
constant $acl ACL constant
- $metaHeaders
array $metaHeaders Array of x-amz-meta-* headers
- $contentType
string $contentType Content type
Returns
boolean
|
public static
boolean
|
#
putObjectString( string $string, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE , array $metaHeaders = array(), string $contentType = 'text/plain' )
Put an object from a string (legacy function)
Put an object from a string (legacy function)
Parameters
- $string
string $string Input data
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $acl
constant $acl ACL constant
- $metaHeaders
array $metaHeaders Array of x-amz-meta-* headers
- $contentType
string $contentType Content type
Returns
boolean
|
public static
mixed
|
#
getObject( string $bucket, string $uri, mixed $saveTo = false )
Get an object
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $saveTo
mixed $saveTo Filename or resource to write to
Returns
mixed
|
public static
mixed
|
#
getObjectInfo( string $bucket, string $uri, boolean $returnInfo = true )
Get object information
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $returnInfo
boolean $returnInfo Return response information
Returns
mixed | false
|
public static
mixed
|
#
copyObject( string $srcBucket, string $srcUri, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE , array $metaHeaders = array(), array $requestHeaders = array(), constant $storageClass = S3::STORAGE_CLASS_STANDARD )
Copy an object
Parameters
- $srcBucket
string $bucket Source bucket name
- $srcUri
string $uri Source object URI
- $bucket
string $bucket Destination bucket name
- $uri
string $uri Destination object URI
- $acl
constant $acl ACL constant
- $metaHeaders
array $metaHeaders Optional array of x-amz-meta-* headers
- $requestHeaders
array $requestHeaders Optional array of request headers (content type, disposition,
etc.)
- $storageClass
constant $storageClass Storage class constant
Returns
mixed | false
|
public static
boolean
|
#
setBucketLogging( string $bucket, string $targetBucket, string $targetPrefix = null )
Set logging for a bucket
Parameters
- $bucket
string $bucket Bucket name
- $targetBucket
string $targetBucket Target bucket (where logs are stored)
- $targetPrefix
string $targetPrefix Log prefix (e,g; domain.com-)
Returns
boolean
|
public static
array
|
#
getBucketLogging( string $bucket )
Get logging status for a bucket
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
Parameters
- $bucket
string $bucket Bucket name
Returns
array | false
|
public static
boolean
|
#
disableBucketLogging( string $bucket )
Disable bucket logging
Parameters
- $bucket
string $bucket Bucket name
Returns
boolean
|
public static
string
|
#
getBucketLocation( string $bucket )
Get a bucket's location
Parameters
- $bucket
string $bucket Bucket name
Returns
string | false
|
public static
boolean
|
#
setAccessControlPolicy( string $bucket, string $uri = '', array $acp = array() )
Set object or bucket Access Control Policy
Set object or bucket Access Control Policy
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $acp
array $acp Access Control Policy Data (same as the data returned from
getAccessControlPolicy)
Returns
boolean
|
public static
mixed
|
#
getAccessControlPolicy( string $bucket, string $uri = '' )
Get object or bucket Access Control Policy
Get object or bucket Access Control Policy
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
Returns
mixed | false
|
public static
boolean
|
#
deleteObject( string $bucket, string $uri )
Delete an object
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
Returns
boolean
|
public static
string
|
#
getAuthenticatedURL( string $bucket, string $uri, integer $lifetime, boolean $hostBucket = false, boolean $https = false )
Get a query string authenticated URL
Get a query string authenticated URL
Parameters
- $bucket
string $bucket Bucket name
- $uri
string $uri Object URI
- $lifetime
integer $lifetime Lifetime in seconds
- $hostBucket
boolean $hostBucket Use the bucket name as the hostname
- $https
boolean $https Use HTTPS ($hostBucket should be false for SSL verification)
Returns
string
|
public static
string
|
#
getSignedPolicyURL( array $policy )
Get a CloudFront signed policy URL
Get a CloudFront signed policy URL
Parameters
- $policy
array $policy Policy
Returns
string
|
public static
string
|
#
getSignedCannedURL( string $url, integer $lifetime )
Get a CloudFront canned policy URL
Get a CloudFront canned policy URL
Parameters
- $url
string $string URL to sign
- $lifetime
integer $lifetime URL lifetime
Returns
string
|
public static
object
|
#
getHttpUploadPostParams( string $bucket, string $uriPrefix = '', constant $acl = S3::ACL_PRIVATE , integer $lifetime = 3600, integer $maxFileSize = 5242880, string $successRedirect = "201", array $amzHeaders = array(), array $headers = array(), boolean $flashVars = false )
Get upload POST parameters for form uploads
Get upload POST parameters for form uploads
Parameters
- $bucket
string $bucket Bucket name
- $uriPrefix
string $uriPrefix Object URI prefix
- $acl
constant $acl ACL constant
- $lifetime
integer $lifetime Lifetime in seconds
- $maxFileSize
integer $maxFileSize Maximum filesize in bytes (default 5MB)
- $successRedirect
string $successRedirect Redirect URL or 200 / 201 status code
- $amzHeaders
array $amzHeaders Array of x-amz-meta-* headers
- $headers
array $headers Array of request headers or content type as a string
- $flashVars
boolean $flashVars Includes additional "Filename" variable posted by Flash
Returns
object
|
public static
array
|
#
createDistribution( string $bucket, boolean $enabled = true, array $cnames = array(), string $comment = null, string $defaultRootObject = null, string $originAccessIdentity = null, array $trustedSigners = array() )
Create a CloudFront distribution
Create a CloudFront distribution
Parameters
- $bucket
string $bucket Bucket name
- $enabled
boolean $enabled Enabled (true/false)
- $cnames
array $cnames Array containing CNAME aliases
- $comment
string $comment Use the bucket name as the hostname
- $defaultRootObject
string $defaultRootObject Default root object
- $originAccessIdentity
string $originAccessIdentity Origin access identity
- $trustedSigners
array $trustedSigners Array of trusted signers
Returns
array | false
|
public static
array
|
#
getDistribution( string $distributionId )
Get CloudFront distribution info
Get CloudFront distribution info
Parameters
- $distributionId
string $distributionId Distribution ID from listDistributions()
Returns
array | false
|
public static
array
|
#
updateDistribution( array $dist )
Update a CloudFront distribution
Update a CloudFront distribution
Parameters
- $dist
array $dist Distribution array info identical to output of getDistribution()
Returns
array | false
|
public static
boolean
|
#
deleteDistribution( array $dist )
Delete a CloudFront distribution
Delete a CloudFront distribution
Parameters
- $dist
array $dist Distribution array info identical to output of getDistribution()
Returns
boolean
|
public static
array
|
#
listDistributions( )
Get a list of CloudFront distributions
Get a list of CloudFront distributions
Returns
array
|
public static
array
|
#
listOriginAccessIdentities( )
List CloudFront Origin Access Identities
List CloudFront Origin Access Identities
Returns
array
|
public static
boolean
|
#
invalidateDistribution( string $distributionId, array $paths )
Invalidate objects in a CloudFront distribution
Invalidate objects in a CloudFront distribution
Thanks to Martin Lindkvist for S3::invalidateDistribution()
Parameters
- $distributionId
string $distributionId Distribution ID from listDistributions()
- $paths
array $paths Array of object paths to invalidate
Returns
boolean
|
private static
string
|
#
__getCloudFrontInvalidationBatchXML( array $paths, mixed $callerReference = '0' )
Get a InvalidationBatch DOMDocument
Get a InvalidationBatch DOMDocument
Parameters
- $paths
array $paths Paths to objects to invalidateDistribution
- $callerReference
Returns
string
|
private static
string
|
#
__getCloudFrontDistributionConfigXML( string $bucket, boolean $enabled, string $comment, string $callerReference = '0', array $cnames = array(), string $defaultRootObject = null, string $originAccessIdentity = null, array $trustedSigners = array() )
Get a DistributionConfig DOMDocument
Get a DistributionConfig DOMDocument
http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?PutConfig.html
Parameters
- $bucket
string $bucket S3 Origin bucket
- $enabled
boolean $enabled Enabled (true/false)
- $comment
string $comment Comment to append
- $callerReference
string $callerReference Caller reference
- $cnames
array $cnames Array of CNAME aliases
- $defaultRootObject
string $defaultRootObject Default root object
- $originAccessIdentity
string $originAccessIdentity Origin access identity
- $trustedSigners
array $trustedSigners Array of trusted signers
Returns
string
|
private static
array
|
#
__parseCloudFrontDistributionConfig( object & $node )
Parse a CloudFront distribution config
|
private static
object
|
#
__getCloudFrontResponse( object & $rest )
Grab CloudFront response
Parameters
- $rest
object &$rest S3Request instance
Returns
object
|
public static
string
|
#
__getMimeType( string & $file )
Get MIME type for file
Parameters
- $file
string &$file File path
Returns
string
|
public static
string
|
#
__getSignature( string $string )
Generate the auth string: "AWS AccessKey:Signature"
Generate the auth string: "AWS AccessKey:Signature"
Parameters
- $string
string $string String to sign
Returns
string
|
private static
string
|
#
__getHash( string $string )
Creates a HMAC-SHA1 hash
This uses the hash extension if loaded
Parameters
- $string
string $string String to sign
Returns
string
|