Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Zend Framework 101: Zend_Service_Amazon_S3

Managing Objects in Amazon S3 Buckets

You can manage objects in an S3 bucket either by using the functions provided in the Zend_Service_Amazon_S3 class, or by registering S3 as a PHP stream and using the native stream handling functions (such as fopen(), fread(), fwrite(), etc.).

We're only going to look at the API methods in this article; refer to Zend Framework documentation for more details about using streams. The primary methods are as follows:

  • putObject() - Used to create a new object with the given data
  • putFile() - Used to create a new object from the given path name
  • putFileStream() - Used to create a new object from a file stream (saves PHP reading in the entire file into memory as putFile() does)
  • removeObject() - Removes the object from the bucket
  • getInfo() - Retrieves information about a given object
  • IsObjectAvailable() - Check if an object exists.
  • getObject() - Retrieves the data for the given object
  • getObjectStream() - Returns the data as a stream (saves PHP reading in the entire object into memory as getObject() does)
  • getObjectsByBucket() - Retrieve a list of objects in a bucket. You can filter this list by a given prefix.

In This Article

Bonus listings: 2 available