Skip to content

Latest commit

 

History

History
160 lines (122 loc) · 3.9 KB

2-cloud-storage-providers.md

File metadata and controls

160 lines (122 loc) · 3.9 KB

Cloud storage providers

One of the core feature of Flysystem is its ability to interact easily with remote filesystems, including many cloud storage providers. This bundle provides the same level of support for these cloud providers by providing corresponding adapters in the configuration.

Azure

Installation

composer require league/flysystem-azure-blob-storage

Usage

# config/packages/flysystem.yaml

flysystem:
    storages:
        users.storage:
            adapter: 'azure'
            options:
                client: 'azure_client_service' # The service ID of the MicrosoftAzure\Storage\Blob\BlobRestProxy instance
                container: 'container_name'
                prefix: 'optional/path/prefix'

AsyncAws S3

Installation

composer require league/flysystem-async-aws-s3

Usage

# config/packages/flysystem.yaml

flysystem:
    storages:
        users.storage:
            adapter: 'asyncaws'
            options:
                client: 'aws_client_service' # The service ID of the AsyncAws\S3\S3Client instance
                bucket: 'bucket_name'
                prefix: 'optional/path/prefix'

AWS SDK S3

Installation

composer require league/flysystem-aws-s3-v3

Usage

# config/packages/flysystem.yaml

flysystem:
    storages:
        users.storage:
            adapter: 'aws'
            # visibility: public # Make the uploaded file publicly accessible in S3
            options:
                client: 'aws_client_service' # The service ID of the Aws\S3\S3Client instance
                bucket: 'bucket_name'
                prefix: 'optional/path/prefix'
                streamReads: true

Google Cloud Storage

Installation

composer require league/flysystem-google-cloud-storage

Usage

# config/packages/flysystem.yaml
 
flysystem:
    storages:
        users.storage:
            adapter: 'gcloud'
            options:
                client: 'gcloud_client_service' # The service ID of the Google\Cloud\Storage\StorageClient instance
                bucket: 'bucket_name'
                prefix: 'optional/path/prefix'

DigitalOcean Spaces

The DigitalOcean Spaces are compatible with the AWS S3 API, meaning that you can use the same configuration as for a AWS storage. For example:

# config/packages/flysystem.yaml

services:
    digitalocean_spaces_client:
        class: 'AsyncAws\S3\S3Client'
        arguments:
            -  endpoint: '%env(DIGITALOCEAN_SPACES_ENDPOINT)%'
               accessKeyId: '%env(DIGITALOCEAN_SPACES_ID)%'
               accessKeySecret: '%env(DIGITALOCEAN_SPACES_SECRET)%'

flysystem:
    storages:
        cdn.storage:
            adapter: 'asyncaws'
            options:
                client: 'digitalocean_spaces_client'
                bucket: '%env(DIGITALOCEAN_SPACES_BUCKET)%'

Scaleway Object Storage

The Scaleway Object Storage is compatible with the AWS S3 API, meaning that you can use the same configuration as for a AWS storage. For example:

# config/packages/flysystem.yaml

services:
    scaleway_spaces_client:
        class: 'AsyncAws\S3\S3Client'
        arguments:
            -  endpoint: '%env(SCALEWAY_SPACES_ENDPOINT)%'
               accessKeyId: '%env(SCALEWAY_SPACES_ID)%'
               accessKeySecret: '%env(SCALEWAY_SPACES_SECRET)%'

flysystem:
    storages:
        cdn.storage:
            adapter: 'asyncaws'
            options:
                client: 'scaleway_spaces_client'
                bucket: '%env(SCALEWAY_SPACES_BUCKET)%'

Next

Interacting with FTP and SFTP servers