Azure Adapter
Wrapper for Flysystem adapter for the Windows Azure with Joomla events support.
1. Usage
To use the adapter programmatically you can use:
JLoader::import('flysystem.library');
use MicrosoftAzure\Storage\Common\ServicesBuilder;
use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\Adapter\Azure;
$endpoint = sprintf(
'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
'account-name',
'api-key'
);
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint);
$filesystem = new Filesystem(new Azure($blobRestProxy, 'my-container'));
2. Events
Global events.
These events allow to perform common actions for all the adapters with a single entry point.
onFlysystemBeforeLoadAdapter Called before an AdapterInterface instance is created.
/**
* Triggered before adapter has been loaded.
*
* @param AdapterInterface $adapter Adapter being instatiated
*
* @return void
*/
public function onFlysystemBeforeLoadAdapter(AdapterInterface $adapter)
onFlysystemAfterLoadAdapter Called after an AdapterInterface instance has been created.
/**
* Triggered after adapter has been loaded.
*
* @param AdapterInterface $adapter Adapter being instatiated
*
* @return void
*/
public function onFlysystemAfterLoadAdapter(AdapterInterface $adapter)
Custom events
onFlysystemBeforeLoadAzureAdapter Called before an Azure adapter instance is created.
/**
* Triggered before adapter has been loaded.
*
* @param Azure $adapter Adapter being instatiated
* @param IBlob $azureClient Client to connect.
* @param string $container Name of the container
* @param string $prefix Optional prefix.
*
* @return void
*/
public function onFlysystemBeforeLoadAzureAdapter(Azure $adapter, IBlob $azureClient, &$container, &$prefix = null)
onFlysystemAfterLoadAzureAdapter Called after an Azure adapter instance has been created.
/**
* Triggered after adapter has been loaded.
*
* @param Azure $adapter Adapter being instatiated
* @param IBlob $azureClient Client to connect.
* @param string $container Name of the container
* @param string $prefix Optional prefix.
*
* @return void
*/
public function onFlysystemAfterLoadAzureAdapter(Azure $adapter, IBlob $azureClient, $container, $prefix = null)