AWS S3 v3 Adapter

Wrapper for Flysystem Adapter for AWS SDK V3 with Joomla events support.

  1. Usage
  2. Events

1. Usage

To use the adapter programmatically you can use:

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

use Aws\S3\S3Client;
use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\Adapter\AwsS3;

$client = S3Client::factory([
    'credentials' => [
        'key'    => 'your-key',
        'secret' => 'your-secret',
    ],
    'region' => 'your-region',
    'version' => 'latest|version',
]);

$adapter = new AwsS3($client, 'your-bucket-name', 'optional/path/prefix');
$filesystem = new Filesystem($adapter);

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

onFlysystemBeforeLoadAwsS3Adapter Called before an AwsS3 adapter instance is created.

/**
 * Triggered before adapter has been loaded.
 *
 * @param   AwsS3     $adapter  Adapter being instatiated
 * @param   S3Client  $client   Client to connect to s3
 * @param   string    $bucket   Bucket name
 * @param   string    $prefix   Optional prefix.
 * @param   array     $options  Additional options.
 *
 * @return  void
 */
public function onFlysystemBeforeLoadAwsS3Adapter(AwsS3 $adapter, S3Client $client, $bucket, $prefix, array &$options)

onFlysystemAfterLoadAwsS3Adapter Called after an AwsS3 adapter instance has been created.

/**
 * Triggered after adapter has been loaded.
 *
 * @param   AwsS3     $adapter  Adapter being instatiated
 * @param   S3Client  $client   Client to connect to s3
 * @param   string    $bucket   Bucket name
 * @param   string    $prefix   Optional prefix.
 * @param   array     $options  Additional options.
 *
 * @return  void
 */
public function onFlysystemAfterLoadAwsS3Adapter(AwsS3 $adapter, S3Client $client, $bucket, $prefix, array $options)