Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Use the Storage Emulator with the Windows Azure SDK for PHP

DZone's Guide to

How to Use the Storage Emulator with the Windows Azure SDK for PHP

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.

This is a short post to address this question: How do I use the local Storage Emulator (formerly known as Development Storage) when using the Windows Azure SDK for PHP? The Windows Azure Command Line Tools for PHP provide an option for running an application locally in the Compute Emulator, but I didn’t see an option for using the local Storage Emulator.  As it turns out, the answer is very simple, although somewhat difficult to find…

When constructing a new table, blob, or queue client, simply omit the constructor parameters:

// Create table, blob, and queue clients
// that use local development storage.
$tableClient = new Microsoft_WindowsAzure_Storage_Table();
$blobClient = new Microsoft_WindowsAzure_Storage_Blob();
$queueClient = new Microsoft_WindowsAzure_Storage_Queue();


Assuming you have installed all the prerequisites for using the Windows Azure SDK for PHP, that’s it. (You will have to start the Compute Emulator and Development Storage before testing your application.) The SDK has all the plumbing for utilizing the Storage Emulator. (I spent quite a bit of time trying to tweak Azure config files to get an application to use the Storage Emulator before realizing this.)

Testing an Azure application will have multiple phases, but initially testing against the local storage will save some storage costs. For more information about developing, testing, and deploying PHP applications to Windows Azure, check out these links:


Thanks.

-Brian

MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:

Published at DZone with permission of Brian Swan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}