Skip to content

Instantly share code, notes, and snippets.

@jeremeamia
Created May 29, 2015 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremeamia/c337949d9eb92bf5ea54 to your computer and use it in GitHub Desktop.
Save jeremeamia/c337949d9eb92bf5ea54 to your computer and use it in GitHub Desktop.
Code needed for Laravel for S3 Flysystem integration
<?php
/**
* Create an instance of the Amazon S3 driver.
*
* @param array $config
* @return \Illuminate\Contracts\Filesystem\Cloud
*/
public function createS3Driver(array $config)
{
$config += [
'credentials' => array_only($config, ['key', 'secret']),
'version' => 'latest',
];
unset($config['key'], $config['secret']);
return $this->adapt(
new Flysystem(new S3Adapter(new S3Client($config), $config['bucket']))
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment