Zend Framework
1.12
|
Public Member Functions | |
setEndpoint ($endpoint) | |
Set S3 endpoint to use. | |
getEndpoint () | |
Get current S3 endpoint. | |
__construct ($accessKey=null, $secretKey=null, $region=null) | |
Constructor. | |
_validBucketName ($bucket) | |
Verify if the bucket name is valid. | |
createBucket ($bucket, $location=null) | |
Add a new bucket. | |
isBucketAvailable ($bucket) | |
Checks if a given bucket name is available. | |
isObjectAvailable ($object) | |
Checks if a given object exists. | |
removeBucket ($bucket) | |
Remove a given bucket. | |
getInfo ($object) | |
Get metadata information for a given object. | |
getBuckets () | |
List the S3 buckets. | |
cleanBucket ($bucket) | |
Remove all objects in the bucket. | |
getObjectsByBucket ($bucket, $params=array()) | |
List the objects in a bucket. | |
getObjectsAndPrefixesByBucket ($bucket, $params=array()) | |
List the objects and common prefixes in a bucket. | |
getObject ($object, $paidobject=false) | |
Get an object. | |
getObjectStream ($object, $streamfile=null, $paidobject=false) | |
Get an object using streaming. | |
putObject ($object, $data, $meta=null) | |
Upload an object by a PHP string. | |
putFile ($path, $object, $meta=null) | |
Put file to S3 as object. | |
putFileStream ($path, $object, $meta=null) | |
Put file to S3 as object, using streaming. | |
removeObject ($object) | |
Remove a given object. | |
copyObject ($sourceObject, $destObject, $meta=null) | |
Copy an object. | |
moveObject ($sourceObject, $destObject, $meta=null) | |
Move an object. | |
_makeRequest ($method, $path='', $params=null, $headers=array(), $data=null) | |
Make a request to Amazon S3. | |
registerAsClient ($name) | |
Register this object as stream wrapper client. | |
unregisterAsClient ($name) | |
Unregister this object as stream wrapper client. | |
registerStreamWrapper ($name='s3') | |
Register this object as stream wrapper. | |
unregisterStreamWrapper ($name='s3') | |
Unregister this object as stream wrapper. | |
![]() | |
__construct ($accessKey=null, $secretKey=null) | |
Create Amazon client. | |
Static Public Member Functions | |
static | getMimeType ($path) |
Attempt to get the content-type of a file based on the extension. | |
static | getWrapperClient ($name) |
Get wrapper client for stream type. | |
![]() | |
static | setKeys ($accessKey, $secretKey) |
Set the keys to use when accessing SQS. | |
![]() | |
static | setHttpClient (Zend_Http_Client $httpClient) |
Sets the HTTP client object to use for retrieving the feeds. | |
static | getHttpClient () |
Gets the HTTP client object. | |
Public Attributes | |
const | S3_ENDPOINT = 's3.amazonaws.com' |
const | S3_ACL_PRIVATE = 'private' |
const | S3_ACL_PUBLIC_READ = 'public-read' |
const | S3_ACL_PUBLIC_WRITE = 'public-read-write' |
const | S3_ACL_AUTH_READ = 'authenticated-read' |
const | S3_REQUESTPAY_HEADER = 'x-amz-request-payer' |
const | S3_ACL_HEADER = 'x-amz-acl' |
const | S3_CONTENT_TYPE_HEADER = 'Content-Type' |
Protected Member Functions | |
_fixupObjectName ($object) | |
Make sure the object name is valid. | |
addSignature ($method, $path, &$headers) | |
Add the S3 Authorization signature to the request headers. | |
![]() | |
_getAccessKey () | |
Method to fetch the Access Key. | |
_getSecretKey () | |
Method to fetch the Secret AWS Key. | |
Protected Attributes | |
$_endpoint | |
![]() | |
$_secretKey | |
$_accessKey | |
Static Protected Attributes | |
static | $_wrapperClients = array() |
![]() | |
static | $_defaultAccessKey = null |
static | $_defaultSecretKey = null |
![]() | |
static | $_httpClient = null |
__construct | ( | $accessKey = null , |
|
$secretKey = null , |
|||
$region = null |
|||
) |
Constructor.
string | $accessKey | |
string | $secretKey | |
string | $region |
|
protected |
Make sure the object name is valid.
string | $object |
_makeRequest | ( | $method, | |
$path = '' , |
|||
$params = null , |
|||
$headers = array() , |
|||
$data = null |
|||
) |
Make a request to Amazon S3.
string | $method | Request method |
string | $path | Path to requested object |
array | $params | Request parameters |
array | $headers | HTTP headers |
string | resource | $data | Request data |
_validBucketName | ( | $bucket | ) |
Verify if the bucket name is valid.
string | $bucket |
|
protected |
Add the S3 Authorization signature to the request headers.
string | $method | |
string | $path | |
array | &$headers |
cleanBucket | ( | $bucket | ) |
Remove all objects in the bucket.
string | $bucket |
copyObject | ( | $sourceObject, | |
$destObject, | |||
$meta = null |
|||
) |
Copy an object.
string | $sourceObject | Source object name |
string | $destObject | Destination object name |
array | $meta | (OPTIONAL) Metadata to apply to desination object. Set to null to copy metadata from source object. |
createBucket | ( | $bucket, | |
$location = null |
|||
) |
Add a new bucket.
string | $bucket |
getBuckets | ( | ) |
List the S3 buckets.
getEndpoint | ( | ) |
Get current S3 endpoint.
getInfo | ( | $object | ) |
Get metadata information for a given object.
string | $object |
|
static |
Attempt to get the content-type of a file based on the extension.
string | $path |
getObject | ( | $object, | |
$paidobject = false |
|||
) |
Get an object.
string | $object | |
bool | $paidobject | This is "requestor pays" object |
getObjectsAndPrefixesByBucket | ( | $bucket, | |
$params = array() |
|||
) |
List the objects and common prefixes in a bucket.
Provides the list of object keys and common prefixes that are contained in the bucket. Valid params include the following. prefix - Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders. marker - Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: To get the next page of results use the last key of the current page as the marker. max-keys - The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more. delimiter - Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.
string | $bucket | |
array | $params | S3 GET Bucket Paramater |
getObjectsByBucket | ( | $bucket, | |
$params = array() |
|||
) |
List the objects in a bucket.
Provides the list of object keys that are contained in the bucket. Valid params include the following. prefix - Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders. marker - Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: To get the next page of results use the last key of the current page as the marker. max-keys - The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more. delimiter - Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.
string | $bucket | |
array | $params | S3 GET Bucket Paramater |
getObjectStream | ( | $object, | |
$streamfile = null , |
|||
$paidobject = false |
|||
) |
Get an object using streaming.
Can use either provided filename for storage or create a temp file if none provided.
string | $object | Object path |
string | $streamfile | File to write the stream to |
bool | $paidobject | This is "requestor pays" object |
|
static |
isBucketAvailable | ( | $bucket | ) |
Checks if a given bucket name is available.
string | $bucket |
isObjectAvailable | ( | $object | ) |
Checks if a given object exists.
string | $object |
moveObject | ( | $sourceObject, | |
$destObject, | |||
$meta = null |
|||
) |
Move an object.
Performs a copy to dest + verify + remove source
string | $sourceObject | Source object name |
string | $destObject | Destination object name |
array | $meta | (OPTIONAL) Metadata to apply to destination object. Set to null to retain existing metadata. |
putFile | ( | $path, | |
$object, | |||
$meta = null |
|||
) |
Put file to S3 as object.
string | $path | File name |
string | $object | Object name |
array | $meta | Metadata |
putFileStream | ( | $path, | |
$object, | |||
$meta = null |
|||
) |
Put file to S3 as object, using streaming.
string | $path | File name |
string | $object | Object name |
array | $meta | Metadata |
putObject | ( | $object, | |
$data, | |||
$meta = null |
|||
) |
Upload an object by a PHP string.
string | $object | Object name |
string | resource | $data | Object data (can be string or stream) |
array | $meta | Metadata |
registerAsClient | ( | $name | ) |
registerStreamWrapper | ( | $name = 's3' | ) |
Register this object as stream wrapper.
string | $name |
removeBucket | ( | $bucket | ) |
Remove a given bucket.
All objects in the bucket must be removed prior to removing the bucket.
string | $bucket |
removeObject | ( | $object | ) |
Remove a given object.
string | $object |
setEndpoint | ( | $endpoint | ) |
Set S3 endpoint to use.
string | Zend_Uri_Http | $endpoint |
unregisterAsClient | ( | $name | ) |
Unregister this object as stream wrapper client.
string | $name |
unregisterStreamWrapper | ( | $name = 's3' | ) |
|
protected |
|
staticprotected |
const S3_ACL_AUTH_READ = 'authenticated-read' |
const S3_ACL_HEADER = 'x-amz-acl' |
const S3_ACL_PRIVATE = 'private' |
const S3_ACL_PUBLIC_READ = 'public-read' |
const S3_ACL_PUBLIC_WRITE = 'public-read-write' |
const S3_CONTENT_TYPE_HEADER = 'Content-Type' |
const S3_ENDPOINT = 's3.amazonaws.com' |
const S3_REQUESTPAY_HEADER = 'x-amz-request-payer' |