ZipFile Adapter
Wrapper for Flysystem Zip Adapter with Joomla events support.
1. Usage
To use the adapter programmatically you can use:
JLoader::import('flysystem.library');
use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\Adapter\ZipFile;
$filesystem = new Filesystem(new ZipFile(__DIR__.'/path/to/archive.zip'))
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
onFlysystemBeforeLoadZipFileAdapter Called after a ZipFile adapter instance has been created.
/**
* Triggered before adapter has been loaded.
*
* @param ZipFile $adapter Adapter being instatiated
* @param string $location Path to the zip file
* @param ZipArchive $file Source file.
* @param string $prefix Optional prefix
*
* @return void
*/
public function onFlysystemBeforeLoadZipFileAdapter(ZipFile $adapter, &$location, ZipArchive $file = null, &$prefix = null)
onFlysystemAfterLoadZipFileAdapter Called after a ZipFile adapter instance has been created.
/**
* Triggered after adapter has been loaded.
*
* @param ZipFile $adapter Adapter being instatiated
* @param string $location Path to the zip file
* @param ZipArchive $file Source file.
* @param string $prefix Optional prefix
*
* @return void
*/
public function onFlysystemAfterLoadZipFileAdapter(ZipFile $adapter, $location, ZipArchive $file = null, $prefix = null)