PHPackages                             aivanov-dev/azure-storage-legacy-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. aivanov-dev/azure-storage-legacy-php

ActiveLibrary[File &amp; Storage](/categories/file-storage)

aivanov-dev/azure-storage-legacy-php
====================================

This is a clone from https://github.com/Azure/azure-storage-php modified to support php 5.5.

2.01(5y ago)1916↓50%MITPHPPHP &gt;=5.6.0

Since Apr 21Pushed 5y agoCompare

[ Source](https://github.com/aivanov-dev/azure-storage-legacy-php)[ Packagist](https://packagist.org/packages/aivanov-dev/azure-storage-legacy-php)[ RSS](/packages/aivanov-dev-azure-storage-legacy-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (20)Used By (0)

Microsoft Azure Storage PHP Client Libraries
============================================

[](#microsoft-azure-storage-php-client-libraries)

This is a clone from  modified to support php 5.5.

Microsoft Azure Storage PHP Client Libraries
============================================

[](#microsoft-azure-storage-php-client-libraries-1)

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage services (blobs, tables, queues and files). For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](http://www.windowsazure.com/en-us/develop/php/).

- azure-storage-blob [![Latest Stable Version](https://camo.githubusercontent.com/11af4726d9f525a15f329b54dd09682dca91a615da45dbe1c58b4b34f741f129/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f736f66742f617a7572652d73746f726167652d626c6f622f762f737461626c65)](https://packagist.org/packages/microsoft/azure-storage-blob)
- azure-storage-table [![Latest Stable Version](https://camo.githubusercontent.com/14ea662e9a19582a6419f2c27785c7b691a8cf3b2f5b1d34c14ff06e8bf5f9a2/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f736f66742f617a7572652d73746f726167652d7461626c652f762f737461626c65)](https://packagist.org/packages/microsoft/azure-storage-table)
- azure-storage-queue [![Latest Stable Version](https://camo.githubusercontent.com/13bea04a15bd67975006336ee81b0e061e8ca9a624a6fe56a557038345428084/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f736f66742f617a7572652d73746f726167652d71756575652f762f737461626c65)](https://packagist.org/packages/microsoft/azure-storage-queue)
- azure-storage-file [![Latest Stable Version](https://camo.githubusercontent.com/698c874d0cc0e710579e925ef0b486297bbe71bf42ab982ba5d4dd7347a0e549/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f736f66742f617a7572652d73746f726167652d66696c652f762f737461626c65)](https://packagist.org/packages/microsoft/azure-storage-file)
- azure-storage-common [![Latest Stable Version](https://camo.githubusercontent.com/3aec5ad9a6e15fb14a55a6509b1ce0a28cea0c16825b523e9d44b9f78a5fef8a/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f736f66742f617a7572652d73746f726167652d636f6d6d6f6e2f762f737461626c65)](https://packagist.org/packages/microsoft/azure-storage-common)

> **Note**
>
> - If you are looking for the Service Bus, Service Runtime, Service Management or Media Services libraries, please visit .
> - If you need big file (larger than 2GB) or 64-bit integer support, please install PHP 7 64-bit version.

Features
========

[](#features)

- Blobs
    - create, list, and delete containers, work with container metadata and permissions, list blobs in container
    - create block and page blobs (from a stream or a string), work with blob blocks and pages, delete blobs
    - work with blob properties, metadata, leases, snapshot a blob
- Tables
    - create and delete tables
    - create, query, insert, update, merge, and delete entities
    - batch operations
- Queues
    - create, list, and delete queues, and work with queue metadata and properties
    - create, get, peek, update, delete messages
- Files
    - create, list, and delete file shares and directories
    - create, delete and download files

Please check details on [API reference documents](http://azure.github.io/azure-storage-php).

Getting Started
===============

[](#getting-started)

Minimum Requirements
--------------------

[](#minimum-requirements)

- PHP 5.6 or above
- See [composer.json](composer.json) for dependencies
- Required extension for PHP:

    - php\_fileinfo.dll
    - php\_mbstring.dll
    - php\_openssl.dll
    - php\_xsl.dll
- Recommended extension for PHP:

    - php\_curl.dll

Download Source Code
--------------------

[](#download-source-code)

To get the source code from GitHub, type

```
git clone https://github.com/Azure/azure-storage-php.git
cd ./azure-storage-php

```

Install via Composer
--------------------

[](#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/azure-storage-blob": "*",
    "microsoft/azure-storage-table": "*",
    "microsoft/azure-storage-queue": "*",
    "microsoft/azure-storage-file": "*"
  }
}
```

2. Download **[composer.phar](http://getcomposer.org/composer.phar)** in your project root.
3. Open a command prompt and execute this in your project root

```
php composer.phar install

```

Usage
-----

[](#usage)

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

- First, include the autoloader script:

```
require_once "vendor/autoload.php";
```

- Include the namespaces you are going to use.

    To create any Microsoft Azure service client you need to use the rest proxy classes, such as **BlobRestProxy** class:

```
use MicrosoftAzureLegacy\Storage\Blob\BlobRestProxy;
```

To process exceptions you need:

```
use MicrosoftAzureLegacy\Storage\Common\ServiceException;
```

- To instantiate the service client you will also need a valid [connection string](https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/). The format is:

```
DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]

```

Or:

```
BlobEndpoint=myBlobEndpoint;QueueEndpoint=myQueueEndpoint;TableEndpoint=myTableEndpoint;FileEndpoint=myFileEndpoint;SharedAccessSignature=sasToken

```

Or if AAD authentication is used:

```
BlobEndpoint=myBlobEndpoint;QueueEndpoint=myQueueEndpoint;TableEndpoint=myTableEndpoint;FileEndpoint=myFileEndpoint;AccountName=[yourAccount]

```

Note that account name is required.

- Instantiate a client object - a wrapper around the available calls for the given service.

```
$blobClient = BlobRestProxy::createBlobService($connectionString);
$tableClient = TableRestProxy::createTableService($connectionString);
$queueClient = QueueRestProxy::createQueueService($connectionString);
$fileClient = FileRestProxy::createFileService($connectionString);
```

Or for AAD authentication:

```
$blobClient = BlobRestProxy::createBlobServiceWithTokenCredential($token, $connectionString);
$queueClient = QueueRestProxy::createQueueServiceWithTokenCredential($token, $connectionString);
```

Note that Blob and Queue service supports AAD authentication.

### Using Middlewares

[](#using-middlewares)

To specify the middlewares, user have to create an array with middlewares and put it in the `$requestOptions` with key 'middlewares'. The sequence of the array will affect the sequence in which the middleware is invoked. The `$requestOptions` can usually be set in the options of an API call, such as `MicrosoftAzureLegacy\Storage\Blob\Models\ListBlobOptions`.

The user can push the middleware into the array with key 'middlewares' in services' `$_options` instead when creating them if the middleware is to be applied to each of the API call for a rest proxy. These middlewares will always be invoked after the middlewares in the `$requestOptions`. e.g.:

```
$tableClient = TableRestProxy::createTableService(
    $connectionString,
    $optionsWithMiddlewares
);
```

Each of the middleware should be either an instance of a sub-class that implements `MicrosoftAzureLegacy\Storage\Common\Internal\IMiddleware`, or a `callable` that follows the Guzzle middleware implementation convention.

User can create self-defined middleware that inherits from `MicrosoftAzureLegacy\Storage\Common\Internal\Middlewares\MiddlewareBase`.

### Retrying failures

[](#retrying-failures)

You can use bundled middlewares to retry requests in case they fail for some reason. First you create the middleware:

```
$retryMiddleware = RetryMiddlewareFactory::create(
    RetryMiddlewareFactory::GENERAL_RETRY_TYPE,  // Specifies the retry logic
    3,  // Number of retries
    1000,  // Interval
    RetryMiddlewareFactory::EXPONENTIAL_INTERVAL_ACCUMULATION,  // How to increase the wait interval
    true  // Whether to retry connection failures too, default false
);
```

Then you add the middleware when creating the service as explained above:

```
$optionsWithMiddlewares = [
    'middlewares' = [
        $retryMiddleware
    ],
];
$tableClient = TableRestProxy::createTableService(
    $connectionString,
    $optionsWithMiddlewares
);
```

Or by pushing it to the existing service:

```
$tableClient->pushMiddleware($retryMiddleware);
```

Authentication failures and "not found" errors (HTTP codes 403 &amp; 404) are not retried when using the bundled middleware.

#### Retry types

[](#retry-types)

- `RetryMiddlewareFactory::GENERAL_RETRY_TYPE` - General type of logic that handles retry
- `RetryMiddlewareFactory::APPEND_BLOB_RETRY_TYPE` - For the append blob retry only, currently the same as the general type

#### Interval accumulations

[](#interval-accumulations)

- `RetryMiddlewareFactory::LINEAR_INTERVAL_ACCUMULATION` - The interval will be increased linearly, the *nth* retry will have a wait time equal to *n \* interval*
- `RetryMiddlewareFactory::EXPONENTIAL_INTERVAL_ACCUMULATION` - The interval will be increased exponentially, the *nth* retry will have a wait time equal to *pow(2, n) \* interval*

### Using proxies

[](#using-proxies)

To use proxies during HTTP requests, set system variable `HTTP_PROXY` and the proxy will be used.

Troubleshooting
---------------

[](#troubleshooting)

### Error: Unable to get local issuer certificate

[](#error-unable-to-get-local-issuer-certificate)

cURL can't verify the validity of Microsoft certificate when trying to issue a request call to Azure Storage Services. You must configure cURL to use a certificate when issuing https requests by the following steps:

1. Download the cacert.pem file from [cURL site](http://curl.haxx.se/docs/caextract.html).
2. Then either:

    - Open your php.ini file and add the following line: ```
        curl.cainfo = ""
        ```

        OR
    - Point to the cacert in the options when creating the Relevant Proxy. ```
        //example of creating the FileRestProxy
        $options["http"] = ["verify" => ""];
        FileRestProxy::createFileService($connectionString, $options);
        ```

Code samples
------------

[](#code-samples)

You can find samples in the [samples folder](https://github.com/Azure/azure-storage-php/tree/master/samples).

Migrate from [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/)
=============================================================================

[](#migrate-from-azure-sdk-for-php)

If you are using [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) to access Azure Storage Service, we highly recommend you to migrate to this SDK for faster issue resolution and quicker feature implementation. We are working on supporting the latest service features as well as improvement on existing APIs.

For now, Microsoft Azure Storage PHP client libraries share almost the same interface as the storage blobs, tables, queues and files APIs in Azure SDK for PHP. However, there are some minor breaking changes need to be addressed during your migration. You can find the details in [BreakingChanges.md](BreakingChanges.md).

Need Help?
==========

[](#need-help)

Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) and [github issues](https://github.com/Azure/azure-storage-php/issues) if you have trouble with the provided code.

Contribute Code or Provide Feedback
===================================

[](#contribute-code-or-provide-feedback)

If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). You can find more details for contributing in the [CONTRIBUTING.md](CONTRIBUTING.md).

If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-storage-php/issues) section of the project.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~326 days

Total

18

Last Release

1859d ago

Major Versions

v0.16.0 → v1.0.0-beta.12017-08-03

v0.19.1 → 2.012021-04-16

PHP version history (2 changes)v0.10.0PHP &gt;=5.5.0

2.01PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcdadd469409e631092e61bf0c6cdbd496c31d16e933b575920fecc04d4d7e1?d=identicon)[aivanov-dev](/maintainers/aivanov-dev)

---

Top Contributors

[![katmsft](https://avatars.githubusercontent.com/u/21050104?v=4)](https://github.com/katmsft "katmsft (75 commits)")[![XiaoningLiu](https://avatars.githubusercontent.com/u/6889160?v=4)](https://github.com/XiaoningLiu "XiaoningLiu (32 commits)")[![vinjiang](https://avatars.githubusercontent.com/u/6924113?v=4)](https://github.com/vinjiang "vinjiang (31 commits)")[![hason-msft](https://avatars.githubusercontent.com/u/129233486?v=4)](https://github.com/hason-msft "hason-msft (24 commits)")[![spaze](https://avatars.githubusercontent.com/u/1966648?v=4)](https://github.com/spaze "spaze (19 commits)")[![jeffreylasut](https://avatars.githubusercontent.com/u/412658?v=4)](https://github.com/jeffreylasut "jeffreylasut (10 commits)")[![sergey-shandar](https://avatars.githubusercontent.com/u/902339?v=4)](https://github.com/sergey-shandar "sergey-shandar (8 commits)")[![alex-i07](https://avatars.githubusercontent.com/u/42939853?v=4)](https://github.com/alex-i07 "alex-i07 (7 commits)")[![nowenL](https://avatars.githubusercontent.com/u/6396597?v=4)](https://github.com/nowenL "nowenL (6 commits)")[![z38](https://avatars.githubusercontent.com/u/3948085?v=4)](https://github.com/z38 "z38 (4 commits)")[![luxifer](https://avatars.githubusercontent.com/u/419078?v=4)](https://github.com/luxifer "luxifer (3 commits)")[![jondmcelroy](https://avatars.githubusercontent.com/u/4562548?v=4)](https://github.com/jondmcelroy "jondmcelroy (3 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![dluces](https://avatars.githubusercontent.com/u/262662?v=4)](https://github.com/dluces "dluces (2 commits)")[![jezmck](https://avatars.githubusercontent.com/u/89996?v=4)](https://github.com/jezmck "jezmck (2 commits)")[![subhaze](https://avatars.githubusercontent.com/u/141903?v=4)](https://github.com/subhaze "subhaze (1 commits)")[![duncan3dc](https://avatars.githubusercontent.com/u/546811?v=4)](https://github.com/duncan3dc "duncan3dc (1 commits)")[![willmorgan](https://avatars.githubusercontent.com/u/168688?v=4)](https://github.com/willmorgan "willmorgan (1 commits)")[![wslaghekke](https://avatars.githubusercontent.com/u/617558?v=4)](https://github.com/wslaghekke "wslaghekke (1 commits)")[![yesdevnull](https://avatars.githubusercontent.com/u/468779?v=4)](https://github.com/yesdevnull "yesdevnull (1 commits)")

---

Tags

phpsdkstorageazure

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/aivanov-dev-azure-storage-legacy-php/health.svg)

```
[![Health](https://phpackages.com/badges/aivanov-dev-azure-storage-legacy-php/health.svg)](https://phpackages.com/packages/aivanov-dev-azure-storage-legacy-php)
```

###  Alternatives

[microsoft/azure-storage-common

This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.

4316.8M6](/packages/microsoft-azure-storage-common)[azure-oss/storage

Azure Blob Storage PHP SDK

37985.0k5](/packages/azure-oss-storage)[microsoft/azure-storage-blob

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.

5516.0M60](/packages/microsoft-azure-storage-blob)[microsoft/azure-storage-file

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage File APIs.

152.4M9](/packages/microsoft-azure-storage-file)[rsd/seafile-php-sdk

This is a PHP package for accessing Seafile Web API

3589.1k](/packages/rsd-seafile-php-sdk)[microsoft/azure-storage-queue

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Queue APIs.

142.6M17](/packages/microsoft-azure-storage-queue)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
