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 875. 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 876. 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.




