Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History
Under Construction
This proposal is under construction and is not ready for review.

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Service_Amazon_S3 Component Proposal

Proposed Component Name Zend_Service_Amazon_S3
Developer Notes
Proposers Justin Plock
Revision 1.0 - 10 March 2008: Initial revision. (wiki revision: 3)

Table of Contents

1. Overview

Zend_Service_Amazon_S3 is an implementation of a PHP user-stream wrapper for Amazon's Simple Storage Service (S3)

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will implement the Amazon S3 API
  • This component will use Zend_Http_Client to communicate with S3
  • This component will implement a user-based stream wrapper for S3 (s3://)

4. Dependencies on Other Framework Components

  • Zend_Http_Client

5. Theory of Operation

This component will be utilized using the stream_wrapper_register() PHP method to register a new user-based stream interface to S3. This allows the user to utilize existing fread(), fwrite(), fclose(), mkdir(), rmdir(), and stat() methods to directly interface with S3 buckets and objects.

6. Milestones / Tasks

  • Milestone 1: [DONE] Design notes will be published here
  • Milestone 2: Working prototype checked into the incubator supporting use cases
  • Milestone 3: Unit tests exist, work, and are checked into SVN.
  • Milestone 4: Initial documentation exists.

7. Class Index

  • Zend_Service_Amazon_S3

8. Use Cases


require_once 'S3.php';

define('AWS_ACCESS_KEY', 'my-access-key');
define('AWS_SECRET_KEY', 'my-secret-key');


if (!stream_wrapper_register('s3', 'S3')) {
echo 'Could not register S3 stream';


$f = fopen('s3://php-test/file.txt', 'w');
for ($i = 0; $i <= 10000; $i++) {
fwrite($f, "Line #$i");

$f = fopen('s3://php-test/file.txt', 'r');

$data = '';
while (!feof($f)) {
$data .= fread($f, 1024);

echo '<hr>';
echo nl2br($data);
echo '<hr/>';

$e = opendir('s3://');
while (($f = readdir($e)) !== false) {
echo "BUCKET: $f<BR>";

$stat = stat('s3://php-test/file.txt');

$stat = stat('s3://php-test');


9. Class Skeletons


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.