Service/Amazon/S3.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Service
- subpackage
- Amazon_S3
- version
- $Id: S3.php 24083 2011-05-30 10:52:55Z ezimuel $
\Zend_Service_Amazon_S3
Amazon S3 PHP connection class
- Extends from
- \Zend_Service_Amazon_Abstract
- see
- \http://docs.amazonwebservices.com/AmazonS3/2006-03-01/
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Service
- subpackage
- Amazon_S3
Constants
Properties



array
$_wrapperClients= 'array'
staticStore for stream wrapper clients
Default valuearray
Details
- Type
- array
Methods



_fixupObjectName(
string $object
)
:
string
Make sure the object name is valid
Parameters
Name |
Type |
Description |
$object |
string |
|
Returns



_makeRequest(
string $method, string $path, array $params
=
null, array $headers
=
array, string|resource $data
=
null
)
:
\Zend_Http_Response
Make a request to Amazon S3
Parameters
Name |
Type |
Description |
$method |
string |
Request method |
$path |
string |
Path to requested object |
$params |
array |
Request parameters |
$headers |
array |
HTTP headers |
$data |
string|resource |
Request data |
Returns



_validBucketName(
string $bucket
)
:
boolean
Verify if the bucket name is valid
Parameters
Name |
Type |
Description |
$bucket |
string |
|
Returns



addSignature(
string $method, string $path, array $headers
)
:
string
Add the S3 Authorization signature to the request headers
Parameters
Name |
Type |
Description |
$method |
string |
|
$path |
string |
|
$headers |
array |
&$headers
|
Returns



cleanBucket(
string $bucket
)
:
boolean
Remove all objects in the bucket.
Parameters
Name |
Type |
Description |
$bucket |
string |
|
Returns



copyObject(
string $sourceObject, string $destObject, array $meta
=
null
)
:
boolean
Parameters
Name |
Type |
Description |
$sourceObject |
string |
Source object name |
$destObject |
string |
Destination object name |
$meta |
array |
(OPTIONAL) Metadata to apply to desination object. Set to null to copy metadata from source object.
|
Returns



getInfo(
string $object
)
:
array|false
Get metadata information for a given object
Parameters
Name |
Type |
Description |
$object |
string |
|
Returns
Type |
Description |
arrayfalse |
|



getMimeType(
string $path
)
:
string
staticAttempt to get the content-type of a file based on the extension
Parameters
Name |
Type |
Description |
$path |
string |
|
Returns



getObject(
string $object, bool $paidobject
=
false
)
:
string|false
Parameters
Name |
Type |
Description |
$object |
string |
|
$paidobject |
bool |
This is "requestor pays" object
|
Returns
Type |
Description |
stringfalse |
|



getObjectStream(
string $object, string $streamfile
=
null, bool $paidobject
=
false
)
:
\Zend_Http_Response_Stream|false
Get an object using streaming
Can use either provided filename for storage or create a temp file if none provided.
Parameters
Name |
Type |
Description |
$object |
string |
Object path |
$streamfile |
string |
File to write the stream to |
$paidobject |
bool |
This is "requestor pays" object
|
Returns



getObjectsByBucket(
string $bucket, array $params
=
array
)
:
array|false
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.
Parameters
Name |
Type |
Description |
$bucket |
string |
|
$params |
array |
S3 GET Bucket Paramater |
Returns
Type |
Description |
arrayfalse |
|



getWrapperClient(
string $name
)
:
\Zend_Service_Amazon_S3
staticGet wrapper client for stream type
Parameters
Name |
Type |
Description |
$name |
string |
|
Returns



isBucketAvailable(
string $bucket
)
:
boolean
Checks if a given bucket name is available
Parameters
Name |
Type |
Description |
$bucket |
string |
|
Returns



isObjectAvailable(
string $object
)
:
boolean
Checks if a given object exists
Parameters
Name |
Type |
Description |
$object |
string |
|
Returns



moveObject(
string $sourceObject, string $destObject, array $meta
=
null
)
:
void
Performs a copy to dest + verify + remove source
Parameters
Name |
Type |
Description |
$sourceObject |
string |
Source object name |
$destObject |
string |
Destination object name |
$meta |
array |
(OPTIONAL) Metadata to apply to destination object. Set to null to retain existing metadata.
|



putFileStream(
string $path, string $object, array $meta
=
null
)
:
boolean
Put file to S3 as object, using streaming
Parameters
Name |
Type |
Description |
$path |
string |
File name |
$object |
string |
Object name |
$meta |
array |
Metadata |
Returns



putObject(
string $object, string|resource $data, array $meta
=
null
)
:
boolean
Upload an object by a PHP string
Parameters
Name |
Type |
Description |
$object |
string |
Object name |
$data |
string|resource |
Object data (can be string or stream)
|
$meta |
array |
Metadata |
Returns



registerAsClient(
string $name
)
:
\Zend_Service_Amazon_S3
Register this object as stream wrapper client
Parameters
Name |
Type |
Description |
$name |
string |
|
Returns



registerStreamWrapper(
string $name
=
s3
)
:
\Zend_Service_Amazon_S3
Register this object as stream wrapper
Parameters
Name |
Type |
Description |
$name |
string |
|
Returns



removeBucket(
string $bucket
)
:
boolean
Remove a given bucket. All objects in the bucket must be removed prior
to removing the bucket.
Parameters
Name |
Type |
Description |
$bucket |
string |
|
Returns



unregisterAsClient(
string $name
)
:
\Zend_Service_Amazon_S3
Unregister this object as stream wrapper client
Parameters
Name |
Type |
Description |
$name |
string |
|
Returns



unregisterStreamWrapper(
string $name
=
s3
)
:
\Zend_Service_Amazon_S3
Unregister this object as stream wrapper
Parameters
Name |
Type |
Description |
$name |
string |
|
Returns