MountManager class

This class extends Flysystem MountManager to trigger events that joomla plugins can use to load custom file systems and any other cool stuff you can imagine.

  1. Usage
  2. Events

1. Usage

You shouldn’t need to use this class programmatically because FileServer already does it through an unique instance that ensures that things are only loaded once.

You can however use it like this is you are adding filesystems to use them programmatically:

use JLoader::import('flysystem.library');

use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\MountManager;
use Phproberto\Joomla\Flysystem\Adapter\JoomlaFolder;

$filesystems = [
	'com_sample-site' => new Filesystem(new JoomlaFolder('components/com_sample')),
	'com_sample-admin' => new Filesystem(new JoomlaFolder('administrator/components/com_sample'))
];

// This manager will be able to access default prefixes + your custom ones
$manager = new MountManager($filesystems);

if ($manager->has(com_sample-site://models/books.php))
{
	echo "My component has a books model!";
}

2. Events

onFlysystemBeforeLoadMountManager Called before a MountManager instance is created.

/**
 * Triggered before MountManager has been loaded.
 *
 * @param   MountManager      $mountManager  Loaded MountManager
 * @param   array             $filesystems   Filesystems being loaded
 *
 * @return  void
 */
public function onFlysystemBeforeLoadMountManager(MountManager $mountManager, array &$filesystems)

onFlysystemAfterLoadMountManager Called after a MountManager instance has been created.

/**
 * Triggered after MountManager has been loaded.
 *
 * @param   MountManager      $mountManager  Loaded MountManager
 * @param   array             $filesystems   Filesystems already loaded
 *
 * @return  void
 */
public function onFlysystemAfterLoadMountManager(MountManager $mountManager, array $filesystems)