Ftp Adapter

Wrapper for Flysystem FTP Adapter with Joomla events support.

  1. Usage
  2. Events

1. Usage

To use the adapter programmatically you can use:

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

use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\Adapter\Ftp as Adapter;

$filesystem = new Filesystem(new Adapter([
    'host' => 'ftp.example.com',
    'username' => 'username',
    'password' => 'password',

    /** optional config settings */
    'port' => 21,
    'root' => '/path/to/root',
    'passive' => true,
    'ssl' => true,
    'timeout' => 30,
]));

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

onFlysystemBeforeLoadFtpAdapter Called before an FTP adapter instance has been created.

/**
 * Triggered before adapter has been loaded.
 *
 * @param   Ftp    $adapter  Adapter being instatiated
 * @param   array  $config   Adapter configuration
 *
 * @return  void
 */
public function onFlysystemBeforeLoadFtpAdapter(Ftp $adapter, array &$config)

onFlysystemAfterLoadFtpAdapter Called after an FTP adapter instance has been created.

/**
 * Triggered after adapter has been loaded.
 *
 * @param   Ftp    $adapter  Adapter being instatiated
 * @param   array  $config   Adapter configuration
 *
 * @return  void
 */
public function onFlysystemAfterLoadFtpAdapter(Ftp $adapter, array $config)