693

Product support

Get help in the plugin support forum.

  • Added on Jun 12, 2024
  • Current version: 1.0.1
  • Platform Compatibility
    v3.x use latest
    v2.x not tested
    v1.x not tested
  • Created by
  • Public repository

Categories

This plugin integrates Azure Blob Storage with OctoberCMS v3

Please be aware that this plugin is dependent on Microsoft Azure SDK for PHP which has been discontinued, and therefore will not have any future updates.

Please also be aware of the following notice from Flysystem documentation

It’s important to know this adapter does not fully comply with the adapter contract. The difference(s) is/are: 
 Visibility setting or retrieving is not supported.
 Mimetypes are always resolved, where others do not.
 Directory creation is not supported in any way.

Reference links https://flysystem.thephpleague.com/docs/adapter/azure-blob-storage/ https://github.com/matthewbdaly/laravel-azure-storage/issues/60

Azure Filesystem Driver

This plugin adds a Filesystem driver for Azure Blob Storage.

You need to install the league/flysystem-azure-blob-storage package to use this driver.

composer require league/flysystem-azure-blob-storage:^3.0   

Using the Azure driver

Simply add another disk in filesystems.php.

You will need your Azure Blob account name, API key and container name.

Update the filesystems.php config file

'disks' => [
    'media' => [
        'driver'    => 'azure',
        'endpoint'  => env('AZURE_ENDPOINT'),
        'name'      => env('AZURE_STORAGE_NAME'),
        'key'       => env('AZURE_STORAGE_KEY'),
        'container' => env('AZURE_STORAGE_CONTAINER'),
        'url'       => env('AZURE_STORAGE_URL'),  // Optional
        'visibility' => 'public',
        'throw' => false
    ],

    'azure' => [
        'driver' => 'azure',
        'endpoint'  => env('AZURE_ENDPOINT'),
        'name'      => env('AZURE_STORAGE_NAME'),
        'key'       => env('AZURE_STORAGE_KEY'),
        'container' => env('AZURE_STORAGE_CONTAINER'),
        'url'       => env('AZURE_STORAGE_URL'),  // Optional
        'visibility' => 'public',
        'throw' => false
    ],
]

You can create as many disks as you want.

Add this to your .env file

AZURE_STORAGE_NAME=your_account_name
AZURE_STORAGE_KEY=your_account_key
AZURE_STORAGE_ENDPOINT=https://your_account_name.blob.core. windows.net
AZURE_STORAGE_CONTAINER=your_container_name

Add the following to your .env file to tell your setup to use Azure disk

FILESYSTEM_DRIVER=azure

Now you can start uploading your files using the Media section of October CMS.

To access the files you may use the following code

azureStorageUrl('image.jpg')

For example

<img src="{{ azureStorageUrl('image.jpg') }}" alt="Image from Azure Blob Storage">
1.0.1

First version of AzureStorage

Jun 12, 2024