Skip to content

Instantly share code, notes, and snippets.

@JacobBennett
Last active March 26, 2020 02:43
Show Gist options
  • Select an option

  • Save JacobBennett/d64d08c5638e84d0dfafc38139726b51 to your computer and use it in GitHub Desktop.

Select an option

Save JacobBennett/d64d08c5638e84d0dfafc38139726b51 to your computer and use it in GitHub Desktop.
Regarding Filesystems
<?php
return [
'disks' => [
's3' => [
'driver' => 's3-swap',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'bucket' => env('AWS_BUCKET', 'wilberpay.com'),
'url' => env('AWS_URL'),
// local use
'endpoint' => env('MINIO_ENDPOINT'),
'use_path_style_endpoint' => true,
],
]
];

Filesystem Decision Tree

Filesystem Driver

S3 BUCKET IN PRODUCTION

- How to use:
    - Use s3-swap driver and use minio for local development
    - Use Storage fake for tests

- when to use:
    - backups
    - uploaded files or documents storage (images, pdfs)
    - generated files or documents storage

MINIO IN PRODUCTION

- How to use:
    - Use s3 driver and use minio for local development
    - Use Storage fake for tests

- When to use:
    - Other internal, non-PHP processes need to be able to write to location
    - Convenient to access with Windows file explorer UI
    - Files will only be used internally

LOCAL IN PRODUCTION

- How to use:
    - use local driver
    - Use Storage fake for tests.

- When to use:
    - Files are present that we want in version control
    - Files that will change infrequently enough to justify being part of the repo
    - NON user uploaded files
    - Think "fixtures"

Filesystem Access Keys

Each application should have a single set of credentials per driver. The only exception to this would be if you were using multiple minio drives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment