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