matthewbdaly/laravel-azure-storage
Deprecated (March 2024): Azure Blob Storage driver for Laravel’s Storage API via Flysystem 3 Azure adapter. Provides a custom “azure” disk for Blob containers/URLs. Use the maintained replacement: https://github.com/Azure-OSS/azure-storage-php-adapter-laravel
composer require matthewbdaly/laravel-azure-storage
Matthewbdaly\LaravelAzureStorage\AzureStorageServiceProvider::class to config/app.php).config/filesystems.php:
'azure' => [
'driver' => 'azure',
'account_name' => env('AZURE_STORAGE_ACCOUNT_NAME'),
'account_key' => env('AZURE_STORAGE_ACCOUNT_KEY'),
'container' => env('AZURE_STORAGE_CONTAINER', 'default'),
'endpoint' => env('AZURE_STORAGE_ENDPOINT', 'core.windows.net'),
],
.env:
AZURE_STORAGE_ACCOUNT_NAME=your_account_name
AZURE_STORAGE_ACCOUNT_KEY=your_base64_encoded_key
AZURE_STORAGE_CONTAINER=my-app-files
Storage facade:
use Illuminate\Support\Facades\Storage;
Storage::disk('azure')->put('test.txt', 'Hello from Azure!');
Storage::disk('azure') instead of the default local disk—ideal for multi-tenant or hybrid storage setups (e.g., local for dev, azure for prod).$path = $request->file('avatar')->store('avatars', 'azure');
temporaryUrl() for time-limited public access (requires Azure SAS support via underlying Flysystem adapter):
$url = Storage::disk('azure')->temporaryUrl('private/report.pdf', now()->addHour());
$files = Storage::disk('azure')->listFiles('uploads/');
Storage::disk('azure')->delete($files);
Storage::disk('azure')->put('public/file.png', $contents, 'public');
AZURE_STORAGE_ACCOUNT_KEY is the base64-encoded primary/secondary key from the Azure portal—not the raw hex string. Missing this causes authentication failures.- or contain consecutive hyphens. Enforce this in config or migration scripts.copy() explicitly when migration paths matter.temporaryUrl()), configure CORS rules in Azure Storage Account > CORS settings; otherwise, browser requests may be blocked.league/flysystem-azure-blob-storage directly).azurite (Azure Storage Emulator) in Docker to mock Azure Blob Storage during development:
docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite
How can I help you explore Laravel packages today?