Very easy. Define a new “disk” in config/filesystems.php:

1
2
3
4
5
6
7
    's3-stage' => [
        'driver' => 's3',
        'key'    => env('S3_STAGE_KEY'),
        'secret' => env('S3_STAGE_SECRET'),
        'region' => env('S3_STAGE_REGION'),
        'bucket' => env('S3_STAGE_BUCKET'),
    ],

But don’t use . in your disk name as it will confuse with the array dot notation:

1
2
3
4
5
6
7
8
9
10
11
12
# Illuminate\Filesystem\FilesystemManager

   /**
     * Get the filesystem connection configuration.
     *
     * @param  string  $name
     * @return array
     */
    protected function getConfig($name)
    {
        return $this->app['config']["filesystems.disks.{$name}"];
    }

And then you can call: Storage::disk('s3-stage') like any other disk.

Comments