Skip to content

Instantly share code, notes, and snippets.

@rossriley
Last active July 9, 2019 13:34
Show Gist options
  • Save rossriley/911b849a14717c3563d8 to your computer and use it in GitHub Desktop.
Save rossriley/911b849a14717c3563d8 to your computer and use it in GitHub Desktop.
Adding an S3 filesystem for Bolt
<?php
use Aws\S3\S3Client;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\AwsS3 as Adapter;
$client = S3Client::factory(array(
'key' => '[your key]',
'secret' => '[your secret]',
'region' => '[aws-region]'
));
$adapter = new Adapter($client, 'bucket-name', 'optional-prefix');
$filesystem = new Filesystem($adapter);
// Then with Bolt App
$app['filesystem']->mountFilesystem('s3fs', $filesystem);
@aberrabaa
Copy link

You're completely right @romulo1984 and i propone the migration, but they don't accept to make it on summer cause of roadmap. This project will be plan on several month and meanwhile i have to enable managing filesystem with S3, no choice.

I am on php5.6, Bolt 2.05, and i tryed to create an extension as you propone above.
When you tested this way, did it work with the extension ?

@romulo1984
Copy link

I understand. My tests with that code there were in May 2017, so I really do not remember. But I believe it will not be so difficult. Just create this extension, register and see if everything is going as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment