Download the PHP package jeddsaliba/azure-blob-url-generator without Composer
On this page you can find all versions of the php package jeddsaliba/azure-blob-url-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeddsaliba/azure-blob-url-generator
More information about jeddsaliba/azure-blob-url-generator
Files in jeddsaliba/azure-blob-url-generator
Package azure-blob-url-generator
Short Description Azure Blob SAS URL generator for Laravel and Spatie MediaLibrary
License MIT
Homepage https://github.com/jeddsaliba/azure-blob-url-generator
Informations about the package azure-blob-url-generator
Azure Blob URL Generator
A Laravel package that provides Azure Blob Storage URL generation with SAS (Shared Access Signature) tokens for Spatie Laravel Media Library.
This package extends Spatie's default URL generator to produce Azure Blob Storage URLs with SAS token authentication, enabling secure access to media files stored in Azure Blob Storage.
Requirements
- PHP 8.2 or higher
- Laravel (with Illuminate Support)
- spatie/laravel-medialibrary ^11.17
- azure-oss/storage-blob-laravel ^1.4
Installation
Install the package via Composer:
Register the Service Provider
If you're using Laravel 11+, the service provider may be auto-discovered. Otherwise, add it to the providers array in config/app.php:
Configuration
1. Environment Variables
Add the following variables to your .env file:
| Variable | Description |
|---|---|
AZURE_STORAGE_ENDPOINT |
The full URL of your Azure Storage account (e.g., https://mystorageaccount.blob.core.windows.net) |
AZURE_STORAGE_CONTAINER |
The name of the blob container where media files are stored |
AZURE_STORAGE_SAS_TOKEN |
The SAS token string (without the leading ?) for authenticated access |
Note: Ensure your SAS token has appropriate permissions (e.g.,
rfor read access) and is configured with a suitable expiration for your use case.
2. Configure Spatie Media Library
Update your Spatie Media Library configuration to use this package's URL generator. Publish the media library config if you haven't already:
Then, in config/media-library.php, set the custom URL generator:
3. Configure Your Filesystem
Add the Azure disk to config/filesystems.php:
Set your default media disk in config/media-library.php or via the MEDIA_DISK environment variable:
Usage
Once configured, media URLs are generated automatically when you call getUrl() or getTemporaryUrl() on your media items.
Basic Usage with Spatie Media Library
Generated URL Format
URLs are generated in the following format:
Example:
License
The MIT License (MIT). Please see the License File for more information.
All versions of azure-blob-url-generator with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
spatie/laravel-medialibrary Version ^10.0|^11.0
azure-oss/storage-blob-laravel Version ^1.4