Note that when you create a bucket it is located in a specific region. The full list of regions is available here.
composer require async-aws/simple-s3
An example service definition of the AsyncAws\SimpleS3\SimpleS3Client:
services:
acme.async_aws_s3.client:
class: AsyncAws\SimpleS3\SimpleS3Client
arguments:
- region: '%amazon_s3.region%'
accessKeyId: '%amazon_s3.key%'
accessKeySecret: '%amazon_s3.secret%/K7MDENG/bPxRfiCYEXAMPLEKEY'service_idThe service id of theAsyncAws\SimpleS3\SimpleS3Clientto use. (required)bucket_nameThe name of the S3 bucket to use. (required)detect_content_typeAuto detect the content type. (default false)optionsA list of additional options passed to the adapter.createWhether to create the bucket if it doesn't exist. (default false)directoryA directory to operate in. (default '') This directory will be created in the root of the bucket and all files will be read and written there.aclDefault ACL to apply to the objects
Once the service is set up use its key as the service_id in the gaufrette configuration:
# app/config/config.yml
knp_gaufrette:
adapters:
profile_photos:
async_aws_s3:
service_id: 'acme.async_aws_s3.client'
bucket_name: 'images'
detect_content_type: true
options:
directory: 'profile_photos'