Skip to content

Instantly share code, notes, and snippets.

@jeremeamia
Created May 29, 2015 22:03
Show Gist options
  • Save jeremeamia/c337949d9eb92bf5ea54 to your computer and use it in GitHub Desktop.
Save jeremeamia/c337949d9eb92bf5ea54 to your computer and use it in GitHub Desktop.

Revisions

  1. jeremeamia created this gist May 29, 2015.
    21 changes: 21 additions & 0 deletions laravel-flysystem-aws.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?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']))
    );
    }