Skip to content

Instantly share code, notes, and snippets.

@concuria
Forked from rossriley/boltS3.php
Created February 15, 2017 13:38
Show Gist options
  • Select an option

  • Save concuria/ddc2e83f512974fae2b197f836e91e68 to your computer and use it in GitHub Desktop.

Select an option

Save concuria/ddc2e83f512974fae2b197f836e91e68 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment