Skip to content

Microsoft Azure Blob Storage integration for Laravel's Storage API

License

Notifications You must be signed in to change notification settings

eldor/laravel-azure-storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-azure-storage

Build Status

Microsoft Azure Blob Storage integration for Laravel's Storage API

Installation

Install the package using composer:

composer require matthewbdaly/laravel-azure-storage

On Laravel versions before 5.5 you also need to add the service provider to config/app.php manually:

    Matthewbdaly\LaravelAzureStorage\AzureStorageServiceProvider::class,

Then add this to the disks section of config/filesystems.php:

        'azure' => [
            'driver'    => 'azure',
            'name'      => env('AZURE_STORAGE_NAME'),
            'key'       => env('AZURE_STORAGE_KEY'),
            'container' => env('AZURE_STORAGE_CONTAINER'),
        ],

Finally, add the fields AZURE_STORAGE_NAME, AZURE_STORAGE_KEY and AZURE_STORAGE_CONTAINER to your .env file with the appropriate credentials. Then you can set the azure driver as either your default or cloud driver and use it to fetch and retrieve files as usual.

Constructing a URL

This driver doesn't support the Storage::url($path) method, and adding support as a third-party package doesn't appear to be practical. However, you can construct a URL to retrieve the asset as follows:

$url = 'https://' . config('filesystems.disks.azure.name'). '.blob.core.windows.net/' . config('filesystems.disks.azure.container') . '/' . $filename;

You may want to create a helper function for this.

About

Microsoft Azure Blob Storage integration for Laravel's Storage API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%