Class S3

Description

Amazon S3 PHP class

Located in /lib/core/S3/S3.php (line 38)


	
			
Class Constant Summary
 ACL_AUTHENTICATED_READ = 'authenticated-read'
 ACL_PRIVATE = 'private'
 ACL_PUBLIC_READ = 'public-read'
 ACL_PUBLIC_READ_WRITE = 'public-read-write'
Variable Summary
static mixed $useSSL
Method Summary
static mixed copyObject ( $srcBucket,  $srcUri, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [array $requestHeaders = array()])
static array createDistribution (string $bucket, [boolean $enabled = true], [array $cnames = array()], [string $comment = ''])
static boolean deleteBucket (string $bucket)
static boolean deleteDistribution (array $dist)
static boolean deleteObject (string $bucket, string $uri)
static boolean disableBucketLogging (string $bucket)
static mixed getAccessControlPolicy (string $bucket, [string $uri = ''])
static string getAuthenticatedURL (string $bucket, string $uri, integer $lifetime, [boolean $hostBucket = false], [boolean $https = false])
static void getBucket ( $bucket, [ $prefix = null], [ $marker = null], [ $maxKeys = null], [ $delimiter = null], [ $returnCommonPrefixes = false])
static string getBucketLocation (string $bucket)
static array getBucketLogging (string $bucket)
static array getDistribution (string $distributionId)
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])
static mixed getObject (string $bucket, string $uri, [mixed $saveTo = false])
static mixed getObjectInfo (string $bucket, string $uri, [boolean $returnInfo = true])
static array inputFile (string $file, [mixed $md5sum = true])
static array inputResource ( &$resource, integer $bufferSize, [string $md5sum = ''], string $resource)
static array listBuckets ([boolean $detailed = false])
static array listDistributions ()
static boolean putBucket (string $bucket, [constant $acl = self::ACL_PRIVATE], [string $location = false])
static boolean putObject (mixed $input, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [array $requestHeaders = array()])
static boolean putObjectFile (string $file, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [string $contentType = null])
static boolean putObjectString (string $string, string $bucket, string $uri, [constant $acl = self::ACL_PRIVATE], [array $metaHeaders = array()], [string $contentType = 'text/plain'])
static boolean setAccessControlPolicy (string $bucket, [string $uri = ''], [array $acp = array()])
static void setAuth (string $accessKey, string $secretKey)
static boolean setBucketLogging (string $bucket, string $targetBucket, [string $targetPrefix = null])
static array updateDistribution (array $dist)
static string __getMimeType (string &$file)
static string __getSignature (string $string)
void __construct ([string $accessKey = null], [string $secretKey = null], [boolean $useSSL = true])
Variables
static mixed $useSSL = true (line 45)
  • access: public
Methods
static method copyObject (line 464)

Copy an object

  • return: | false
  • access: public
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
static method createDistribution (line 824)

Create a CloudFront distribution

  • return: | false
  • access: public
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
static method deleteBucket (line 240)

Delete an empty bucket

  • access: public
static boolean deleteBucket (string $bucket)
  • string $bucket: Bucket name
static method deleteDistribution (line 905)

Delete a CloudFront distribution

  • access: public
static boolean deleteDistribution (array $dist)
  • array $dist: Distribution array info identical to output of getDistribution()
static method deleteObject (line 728)

Delete an object

  • access: public
static boolean deleteObject (string $bucket, string $uri)
  • string $bucket: Bucket name
  • string $uri: Object URI
static method disableBucketLogging (line 580)

Disable bucket logging

  • access: public
static boolean disableBucketLogging (string $bucket)
  • string $bucket: Bucket name
static method getAccessControlPolicy (line 672)

Get object or bucket Access Control Policy

  • return: | false
  • access: public
static mixed getAccessControlPolicy (string $bucket, [string $uri = ''])
  • string $bucket: Bucket name
  • string $uri: Object URI
static method getAuthenticatedURL (line 752)

Get a query string authenticated URL

  • access: public
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 method getBucket (line 127)
  • access: public
static void getBucket ( $bucket, [ $prefix = null], [ $marker = null], [ $maxKeys = null], [ $delimiter = null], [ $returnCommonPrefixes = false])
  • $bucket
  • $prefix
  • $marker
  • $maxKeys
  • $delimiter
  • $returnCommonPrefixes
static method getBucketLocation (line 591)

Get a bucket's location

  • return: | false
  • access: public
static string getBucketLocation (string $bucket)
  • string $bucket: Bucket name
static method getBucketLogging (line 555)

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

  • return: | false
  • access: public
static array getBucketLogging (string $bucket)
  • string $bucket: Bucket name
static method getDistribution (line 850)

Get CloudFront distribution info

  • return: | false
  • access: public
static array getDistribution (string $distributionId)
  • string $distributionId: Distribution ID from listDistributions()
static method getHttpUploadPostParams (line 774)

Get upload POST parameters for form uploads

  • access: public
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
static method getObject (line 406)

Get an object

  • access: public
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
static method getObjectInfo (line 438)

Get object information

  • return: | false
  • access: public
static mixed getObjectInfo (string $bucket, string $uri, [boolean $returnInfo = true])
  • string $bucket: Bucket name
  • string $uri: Object URI
  • boolean $returnInfo: Return response information
static method inputFile (line 261)

Create input info array for putObject()

  • return: | false
  • access: public
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)
static method inputResource (line 280)

Create input array info for putObject() with a resource

  • return: | false
  • access: public
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
static method listBuckets (line 85)

Get a list of buckets

  • return: | false
  • access: public
static array listBuckets ([boolean $detailed = false])
  • boolean $detailed: Returns detailed bucket list when true
static method listDistributions (line 927)

Get a list of CloudFront distributions

  • access: public
static array listDistributions ()
static method putBucket (line 207)

Put a bucket

  • access: public
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
static method putObject (line 302)

Put an object

  • access: public
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
static method putObjectFile (line 377)

Put an object from a file (legacy function)

  • access: public
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
static method putObjectString (line 393)

Put an object from a string (legacy function)

  • access: public
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
static method setAccessControlPolicy (line 614)

Set object or bucket Access Control Policy

  • access: public
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)
static method setAuth (line 73)

Set AWS access key and secret key

  • access: public
static void setAuth (string $accessKey, string $secretKey)
  • string $accessKey: Access key
  • string $secretKey: Secret key
static method setBucketLogging (line 496)

Set logging for a bucket

  • access: public
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-)
static method updateDistribution (line 876)

Update a CloudFront distribution

  • return: | false
  • access: public
static array updateDistribution (array $dist)
  • array $dist: Distribution array info identical to output of getDistribution()
static method __getMimeType (line 1047)

Get MIME type for file

  • access: public
static string __getMimeType (string &$file)
  • string &$file: File path
static method __getSignature (line 1095)

Generate the auth string: "AWS AccessKey:Signature"

  • access: public
static string __getSignature (string $string)
  • string $string: String to sign
Constructor __construct (line 59)

Constructor - if you're not using the class statically

  • access: public
void __construct ([string $accessKey = null], [string $secretKey = null], [boolean $useSSL = true])
  • string $accessKey: Access key
  • string $secretKey: Secret key
  • boolean $useSSL: Enable SSL
Class Constants
ACL_AUTHENTICATED_READ = 'authenticated-read' (line 43)
ACL_PRIVATE = 'private' (line 40)
ACL_PUBLIC_READ = 'public-read' (line 41)
ACL_PUBLIC_READ_WRITE = 'public-read-write' (line 42)

Documentation generated on Sun, 06 Mar 2011 00:24:59 -0500 by phpDocumentor 1.4.3