feilongcui / laravel-azure-storage
Microsoft Azure Blob Storage integration for Laravel's Storage API
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 140
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 1
Open Issues: 0
Requires
- league/flysystem: ~1.0
- microsoft/azure-storage-blob: ~1.1.0
- microsoft/azure-storage-file: ~1.1.0
- microsoft/azure-storage-queue: ~1.1.0
- microsoft/azure-storage-table: ~1.1.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^3.5
- phpunit/phpunit: ^6.4
- psy/psysh: ^0.8.13
- squizlabs/php_codesniffer: ^3.1
This package is not auto-updated.
Last update: 2020-12-06 20:12:15 UTC
README
Microsoft Azure Blob Storage integration for Laravel's Storage API
Requirements
- Laravel 5.6
Installation
Install the package using composer:
composer require feilongcui/laravel-azure-storage
Then add this to the disks
section of config/filesystems.php
:
'azure' => [ 'driver' => 'azure', 'name' => env('AZURE_ACCOUNT_NAME'), 'key' => env('AZURE_ACCOUNT_KEY'), 'container' => env('AZURE_CONTAINER_NAME'), ],
Finally, add the fields AZURE_ACCOUNT_NAME
, AZURE_ACCOUNT_KEY
and AZURE_CONTAINER_NAME
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.