From 26d3794f7eb90acff0c5a51ad4709dd8e2ae8d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 2 Dec 2024 16:47:49 +0100 Subject: [PATCH] Add Cloudflare R2 example --- docs/2-cloud-storage-providers.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/2-cloud-storage-providers.md b/docs/2-cloud-storage-providers.md index f5e8bc9..7a4e5d2 100644 --- a/docs/2-cloud-storage-providers.md +++ b/docs/2-cloud-storage-providers.md @@ -10,6 +10,7 @@ cloud providers by providing corresponding adapters in the configuration. * [DigitalOcean Spaces](#digitalocean-spaces) * [Scaleway Object Storage](#scaleway-object-storage) * [Google Cloud Storage](#google-cloud-storage) +* [Cloudflare R2](#cloudflare-r2) ## Azure @@ -157,6 +158,32 @@ flysystem: bucket: '%env(SCALEWAY_SPACES_BUCKET)%' ``` +## Cloudflare R2 + +The Cloudflare R2 is compatible with the AWS S3 API, meaning that you can use the same configuration +as for a AWS storage. For example: + +```yaml +# config/packages/flysystem.yaml + +services: + cloudflare_r2_client: + class: 'AsyncAws\S3\S3Client' + arguments: + - + endpoint: '%env(CLOUDFLARE_R2_ENDPOINT)%' + accessKeyId: '%env(CLOUDFLARE_R2_ID)%' + accessKeySecret: '%env(CLOUDFLARE_R2_SECRET)%' + +flysystem: + storages: + cdn.storage: + adapter: 'asyncaws' + options: + client: 'cloudflare_r2_client' + bucket: '%env(CLOUDFLARE_R2_BUCKET)%' +``` + ## Next [Interacting with FTP and SFTP servers](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/3-interacting-with-ftp-and-sftp-servers.md)