Download the PHP package dreamfactory/azure-sdk-for-php without Composer

On this page you can find all versions of the php package dreamfactory/azure-sdk-for-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package azure-sdk-for-php

Windows Azure SDK for PHP

This project provides a set of PHP client libraries that make it easy to access Windows Azure tables, blobs, queues, service bus (queues and topics), service runtime and service management APIs. For documentation on how to host PHP applications on Windows Azure, please see the Windows Azure PHP Developer Center.

Features

Getting Started

Download Source Code

To get the source code from GitHub, type

git clone https://github.com/WindowsAzure/azure-sdk-for-php.git
cd ./azure-sdk-for-php

Note

The PHP Client Libraries for Windows Azure have a dependency on the HTTP_Request2, Mail_mime, and Mail_mimeDecode PEAR packages. The recommended way to resolve these dependencies is to install them using the PEAR package manager.

Install via Composer

  1. Create a file named composer.json in the root of your project and add the following code to it:

    {
        "require": {
            "microsoft/windowsazure": "*"
        },          
        "repositories": [
            {
                "type": "pear",
                "url": "http://pear.php.net"
            }
        ],
        "minimum-stability": "dev"
    }
  2. Download composer.phar in your project root.

  3. Open a command prompt and execute this in your project root

    php composer.phar install

    Note

    On Windows, you will also need to add the Git executable to your PATH environment variable.

Install as a PEAR package

To install the PHP Client Libraries for Windows Azure as a PEAR package, follow these steps:

  1. Install PEAR.
  2. Set-up the Windows Azure PEAR channel:

    pear channel-discover pear.windowsazure.com
  3. Install the PEAR package:

    pear install pear.windowsazure.com/WindowsAzure-0.4.0

Usage

Getting Started

There are four basic steps that have to be performed before you can make a call to any Windows Azure API when using the libraries.

Table Storage

The following are examples of common operations performed with the Table serivce. For more please read How-to use the Table service.

Create a table

To create a table call createTable:

Error Codes and Messages for Tables

Insert an entity

To add an entity to a table, create a new Entity object and pass it to TableRestProxy->insertEntity. Note that when you create an entity you must specify a PartitionKey and RowKey. These are the unique identifiers for an entity and are values that can be queried much faster than other entity properties. The system uses PartitionKey to automatically distribute the table’s entities over many storage nodes.

Query entities

To query for entities you can call queryEntities. The subset of entities you retrieve will be determined by the filter you use (for more information, see Querying Tables and Entities). You can also provide no filter at all.

Blob Storage

To get started using the Blob service you must include the BlobService and BlobSettings namespaces and set the ACCOUNT_NAME and ACCOUNT_KEY configuration settings for your credentials. Then you instantiate the wrapper using the BlobService factory.

The following are examples of common operations performed with the Blob serivce. For more please read How-to use the Blob service.

Create a container

Error Codes and Messages for Blobs

For more information about container ACLs, see Set Container ACL (REST API).

Upload a blob

To upload a file as a blob, use the BlobRestProxy->createBlockBlob method. This operation will create the blob if it doesn’t exist, or overwrite it if it does. The code example below assumes that the container has already been created and uses fopen to open the file as a stream.

While the example above uploads a blob as a stream, a blob can also be uploaded as a string.

List blobs in a container

To list the blobs in a container, use the BlobRestProxy->listBlobs method with a foreach loop to loop through the result. The following code outputs the name and URI of each blob in a container.

Storage Queues

To get started using the Queue service you must include the QueueService and QueueSettings namespaces and set the ACCOUNT_NAME and ACCOUNT_KEY configuration settings for your credentials. Then you instantiate the wrapper using the QueueService factory.

The following are examples of common operations performed with the Queue serivce. For more please read How-to use the Queue service.

Create a queue

A QueueRestProxy object lets you create a queue with the createQueue method. When creating a queue, you can set options on the queue, but doing so is not required.

Error Codes and Messages for Queues

Add a message to a queue

To add a message to a queue, use QueueRestProxy->createMessage. The method takes the queue name, the message text, and message options (which are optional).

Peek at the next message

You can peek at a message (or messages) at the front of a queue without removing it from the queue by calling QueueRestProxy->peekMessages.

De-queue the next message

Your code removes a message from a queue in two steps. First, you call QueueRestProxy->listMessages, which makes the message invisible to any other code reading from the queue. By default, this message will stay invisible for 30 seconds (if the message is not deleted in this time period, it will become visible on the queue again). To finish removing the message from the queue, you must call QueueRestProxy->deleteMessage.

Service Bus Queues

Create a Queue

Error Codes and Messages

Send a Message

To send a message to a Service Bus queue, your application will call the ServiceBusRestProxy->sendQueueMessage method. Messages sent to (and received from ) Service Bus queues are instances of the BrokeredMessage class.

Receive a Message

The primary way to receive messages from a queue is to use a ServiceBusRestProxy->receiveQueueMessage method. Messages can be received in two different modes: ReceiveAndDelete (mark message as consumed on read) and PeekLock (locks message for a period of time, but does not delete).

The example below demonstrates how a message can be received and processed using PeekLock mode (not the default mode).

Service Bus Topics

Create a Topic

Create a subscription with the default (MatchAll) filter

Send a message to a topic

Messages sent to Service Bus topics are instances of the BrokeredMessage class.

Receive a message from a topic

The primary way to receive messages from a subscription is to use a ServiceBusRestProxy->receiveSubscriptionMessage method. Received messages can work in two different modes: ReceiveAndDelete (the default) and PeekLock similarly to Service Bus Queues.

The example below demonstrates how a message can be received and processed using ReceiveAndDelete mode (the default mode).

Service Management

Set-up certificates

You need to create two certificates, one for the server (a .cer file) and one for the client (a .pem file). To create the .pem file using OpenSSL, execute this:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

To create the .cer certificate, execute this:

openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

List Available Locations

Create a Storage Service

To create a storage service, you need a name for the service (between 3 and 24 lowercase characters and unique within Windows Azure), a label (a base-64 encoded name for the service, up to 100 characters), and either a location or an affinity group. Providing a description for the service is optional.

Create a Cloud Service

A cloud service is also known as a hosted service (from earlier versions of Windows Azure). The createHostedServices method allows you to create a new hosted service by providing a hosted service name (which must be unique in Windows Azure), a label (the base 64-endcoded hosted service name), and a CreateServiceOptions object which allows you to set the location or the affinity group for your service.

Create a Deployment

To make a new deployment to Azure you must store the package file in a Windows Azure Blob Storage account under the same subscription as the hosted service to which the package is being uploaded. You can create a deployment package with the Windows Azure PowerShell cmdlets, or with the cspack commandline tool.

Media Services

Create new asset with file

To create an asset with a file you need to create an empty asset, create access policy with write permission, create a locator joining your asset and access policy, perform actual upload and generate file info.

Encode asset

To perform media file encoding you will need input asset ($inputAsset) with a file in it (something like in previous chapter). Also you need to create an array of task data objects and a job data object. To create a task object use a media processor, task XML body and configuration name.

Get public URL to encoded asset

After you’ve uploaded a media file and encode it you can get a download URL for that file. Create a new access policy with read permission and link it with job output asset via locator.

Manage media services entities

Media services CRUD operations are performed through media services rest proxy class. It has methods like “createAsset”, “createLocator”, “createJob” and etc. for entities creations.

To retrieve all entities list you may use methods “getAssetList”, “getAccessPolicyList”, “getLocatorList”, “getJobList” and etc. For getting single entity data use methods “getAsset”, “getJob”, “getTask” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

Update entities with methods like “updateLocator”, “updateAsset”, “updateAssetFile” and etc. passing the entity data model object as a parameter. It is important to have valid entity identifier specified in data model object.

Erase entities with methods like “deleteAsset”, “deleteAccessPolicy”, “deleteJob” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

Also you could get linked entities with methods “getAssetLocators”, “getAssetParentAssets”, “getAssetStorageAccount”, “getLocatorAccessPolicy”, “getJobTasks” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

The complete list of all methods available you could find in IMediaServices interface.

For more examples please see the Windows Azure PHP Developer Center

Need Help?

Be sure to check out the Windows Azure Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback

If you would like to become an active contributor to this project please follow the instructions provided in Windows Azure Projects Contribution Guidelines.

To setup your development environment, follow the instructions in this wiki page.

If you encounter any bugs with the library please file an issue in the Issues section of the project.

Learn More

Windows Azure PHP Developer Center


All versions of azure-sdk-for-php with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dreamfactory/azure-sdk-for-php contains the following files

Loading the files please wait ....