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

Blob storage stream wrapper

The Windows Azure SDK for PHP provides support for registering a blob storage client as a PHP file stream wrapper. The blob storage stream wrapper provides support for using regular file operations on Windows Azure Blob Storage. For example, one can open a file from Windows Azure Blob Storage with the fopen() function:

Example 894. Example usage of blob storage stream wrapper

<?php
$fileHandle 
fopen('azure://mycontainer/myfile.txt''r');

// ...

fclose($fileHandle);

In order to do this, the Windows Azure SDK for PHP blob storage client must be registered as a stream wrapper. This can be done by calling the registerStreamWrapper() method:

Example 895. Registering the blob storage stream wrapper

<?php
$storageClient 
= new Zend_Service_WindowsAzure_Storage_Blob();

// registers azure:// on this storage client
$storageClient->registerStreamWrapper();

// or:

// regiters blob:// on this storage client
$storageClient->registerStreamWrapper('blob://');

To unregister the stream wrapper, the unregisterStreamWrapper() method can be used.

Zend Framework