Created
May 29, 2015 22:03
-
-
Save jeremeamia/c337949d9eb92bf5ea54 to your computer and use it in GitHub Desktop.
Code needed for Laravel for S3 Flysystem integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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