azure-oss/storage-blob
A community-maintained PHP SDK for Azure Blob Storage supporting containers, blobs, leases, tags, versions, and SAS generation, with connection string, shared key, SAS, and Entra ID auth plus Azurite emulator support.
A PHP SDK for Azure Blob Storage with support for containers, blobs, leases, tags, versions, and SAS generation.
[!IMPORTANT] This package is community-maintained and is not affiliated with, endorsed by, or supported by Microsoft.
composer require azure-oss/storage-blob
<?php
use AzureOss\Storage\Blob\BlobServiceClient;
use AzureOss\Storage\Blob\Models\UploadBlobOptions;
$service = BlobServiceClient::fromConnectionString(
getenv('AZURE_STORAGE_CONNECTION_STRING')
);
$container = $service->getContainerClient('quickstart');
$container->createIfNotExists();
$blob = $container->getBlobClient('hello.txt');
$blob->upload(
'Hello from PHP OSS for Azure',
new UploadBlobOptions(contentType: 'text/plain')
);
$download = $blob->downloadStreaming();
$content = $download->content->getContents();
echo $content.PHP_EOL; // Hello from PHP OSS for Azure
foreach ($container->getBlobs() as $item) {
echo $item->name.PHP_EOL;
}
// Optional cleanup
$blob->deleteIfExists();
// $container->deleteIfExists();
You can read the documentation here.
Migrating from microsoft/azure-storage-blob?
Migrate from microsoft/azure-storage-blob.
This package is part of the community-maintained PHP OSS for Azure project. It is an independent project and is not affiliated with or endorsed by Microsoft.
This project is released under the MIT License. See LICENSE for details.
How can I help you explore Laravel packages today?