<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
Zend_Service_Amazon_S3 is an implementation of the service API and PHP user-stream wrapper for Amazon's Simple Storage Service (S3)Zend Framework: Zend_Service_Amazon_S3 Component Proposal
Proposed Component Name
Zend_Service_Amazon_S3
Developer Notes
http://framework.zend.com/wiki/display/ZFDEV/Zend_Service_Amazon_S3
Proposers
Justin Plock
Alexander Veremyev (Zend liaison)
Stanislav Malyshev
Revision
1.0 - 10 March 2008: Initial revision.
1.1 - 31 December 2008: Revised code committed into laboratory SVN
2.0 - 25 February 2009: Revised the API and finalized the laboratory implementation (wiki revision: 12)Table of Contents
1. Overview
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 provide the API to use Amazon S3 directly
- This component will implement a user-based stream wrapper for S3 (s3://)
- This component will allow using multiple S3 accounts
4. Dependencies on Other Framework Components
- Zend_Http_Client
5. Theory of Operation
This component will provide Amazon S3 API allowing to store and retrieve data from the Amazon S3 service.
Also, 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: [DONE] Working prototype checked into the laboratory supporting use cases
- Milestone 3: [DONE] Unit tests exist, work, and are checked into SVN.
- Milestone 4: [DONE] Initial documentation exists.
- Milestone 5: Proposal accepted and moved to incubator
- Milestone 6: The component is accepted as part of ZF core
7. Class Index
- Zend_Service_Amazon_S3
- Zend_Service_Amazon_S3_Stream
8. Use Cases
require_once 'Zend/Service/Amazon/S3.php';
define('AWS_ACCESS_KEY', 'my-access-key');
define('AWS_SECRET_KEY', 'my-secret-key');
$s3 = new Zend_Service_Amazon_S3(AWS_ACCESS_KEY, AWS_SECRET_KEY);
mkdir('s3://php-test');
$f = fopen('s3://php-test/file.txt', 'w');
for ($i = 0; $i <= 10000; $i++)
fclose($f);
$f = fopen('s3://php-test/file.txt', 'r');
$data = '';
while (!feof($f))
fclose($f);
echo '';
echo nl2br($data);
echo '';
$e = opendir('s3://');
while (($f = readdir($e)) !== false)
closedir($e);
$stat = stat('s3://php-test/file.txt');
var_dump($stat);
$stat = stat('s3://php-test');
var_dump($stat);
unlink('s3://php-test/file.txt');
rmdir('s3://php-test');