PhpRiot
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

Stream wrapper

In addition to the interfaces described above, Zend_Service_Amazon_S3 also supports operating as a stream wrapper. For this, you need to register the client object as the stream wrapper:

Example 775. Zend_Service_Amazon_S3 Streams Example

<?php
require_once 'Zend/Service/Amazon/S3.php';

$s3 = new Zend_Service_Amazon_S3($my_aws_key$my_aws_secret_key);

$s3->registerStreamWrapper("s3");

mkdir("s3://my-own-bucket");
file_put_contents("s3://my-own-bucket/testdata""mydata");

echo 
file_get_contents("s3://my-own-bucket/testdata");

Directory operations (mkdir, rmdir, opendir, etc.) will operate on buckets and thus their arguments should be of the form of s3://bucketname. File operations operate on objects. Object creation, reading, writing, deletion, stat and directory listing is supported.

Zend Framework