PHPackages                             microsoft/azure-storage - 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. microsoft/azure-storage

Abandoned → [microsoft/azure-storage-blob;microsoft/azure-storage-queue;microsoft/azure-storage-table;microsoft/azure-storage-file](/?search=microsoft%2Fazure-storage-blob%3Bmicrosoft%2Fazure-storage-queue%3Bmicrosoft%2Fazure-storage-table%3Bmicrosoft%2Fazure-storage-file)ArchivedLibrary[File &amp; Storage](/categories/file-storage)

microsoft/azure-storage
=======================

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

v0.19.1(8y ago)2162.3M↑17.9%200[54 issues](https://github.com/Azure/azure-storage-php/issues)[6 PRs](https://github.com/Azure/azure-storage-php/pulls)17MITPHPPHP &gt;=5.5.0

Since Apr 21Pushed 3y ago27 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (16)Used By (17)

Microsoft Azure Storage PHP Client Libraries (Deprecated)
=========================================================

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

This project will be in [Community Support](https://azure.github.io/azure-sdk/policies_support.html#package-lifecycle) until 17 March 2024. After this date the project and associated client libraries will be retired permanently. For more details on the retirement and alternatives to using this project, visit [Retirement notice: The Azure Storage PHP client libraries will be retired on 17 March 2024](https://aka.ms/AzStoragePHPSDKRetirement).

---

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 [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php).
> - 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).

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": "*"
  }
}
```

1. Download **[composer.phar](http://getcomposer.org/composer.phar)** in your project root.
2. 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 MicrosoftAzure\Storage\Blob\BlobRestProxy;
```

To process exceptions you need:

```
use MicrosoftAzure\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 `MicrosoftAzure\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 `MicrosoftAzure\Storage\Common\Internal\IMiddleware`, or a `callable` that follows the Guzzle middleware implementation convention.

User can create self-defined middleware that inherits from `MicrosoftAzure\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);
```

Following errors are not retried in current retry middleware:

- Authentication failures.
- "Resource Not Found" errors.
- Guzzle request exceptions that does not bear an HTTP response, e.g. failed to open stream, or cURL Connection reset by peer, etc. *Note:* Community contribution to cover the Guzzle request exceptions are welcomed.

### 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.

Please note this project will be in Community Support and Azure Storage team commits to validate and release every quarter, as long as there are PRs from community. Azure Storage team is unable to continue to add new features or provide bugfixes.

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](https://opensource.microsoft.com/program/#program-contributing). 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

45

—

FairBetter than 93% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity61

Solid adoption and visibility

Community44

Growing community involvement

Maturity56

Maturing project, gaining track record

 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 ~40 days

Recently: every ~25 days

Total

14

Last Release

3158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1e75535040f1f61a8d812c69c76056452917f1bfede07c650a9fe037d64cb40?d=identicon)[azure-dmsh](/maintainers/azure-dmsh)

---

Top Contributors

[![katmsft](https://avatars.githubusercontent.com/u/21050104?v=4)](https://github.com/katmsft "katmsft (105 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 (32 commits)")[![spaze](https://avatars.githubusercontent.com/u/1966648?v=4)](https://github.com/spaze "spaze (30 commits)")[![hason-msft](https://avatars.githubusercontent.com/u/129233486?v=4)](https://github.com/hason-msft "hason-msft (24 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)")[![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)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![jondmcelroy](https://avatars.githubusercontent.com/u/4562548?v=4)](https://github.com/jondmcelroy "jondmcelroy (3 commits)")[![luxifer](https://avatars.githubusercontent.com/u/419078?v=4)](https://github.com/luxifer "luxifer (3 commits)")[![jezmck](https://avatars.githubusercontent.com/u/89996?v=4)](https://github.com/jezmck "jezmck (2 commits)")[![ganboonhong](https://avatars.githubusercontent.com/u/10766871?v=4)](https://github.com/ganboonhong "ganboonhong (2 commits)")[![microsoft-github-policy-service[bot]](https://avatars.githubusercontent.com/in/95686?v=4)](https://github.com/microsoft-github-policy-service[bot] "microsoft-github-policy-service[bot] (2 commits)")[![manumsft](https://avatars.githubusercontent.com/u/82905109?v=4)](https://github.com/manumsft "manumsft (2 commits)")[![dluces](https://avatars.githubusercontent.com/u/262662?v=4)](https://github.com/dluces "dluces (2 commits)")[![schoag-msft](https://avatars.githubusercontent.com/u/114751789?v=4)](https://github.com/schoag-msft "schoag-msft (1 commits)")[![seanmcc-msft](https://avatars.githubusercontent.com/u/44180881?v=4)](https://github.com/seanmcc-msft "seanmcc-msft (1 commits)")[![sebastienwarin](https://avatars.githubusercontent.com/u/6674275?v=4)](https://github.com/sebastienwarin "sebastienwarin (1 commits)")

---

Tags

phpsdkstorageazure

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/microsoft-azure-storage/health.svg)

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

###  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)
