Configure S3 | Gaufrette | Sylius?

1k Views Asked by At

I want to integrate AWS S3 into Sylius. What is the correct way to configure it? In dnd you will find the configuration file of Sylius and Gaufrette inside the package?

1

There are 1 best solutions below

0
ylastapis On

Start by configuring your bundles:

Some gist here https://gist.github.com/ylastapis/e392ac72543504b05b8a332a935e8b9c

Then you'll have to define some services:

services:
    sylius.image_uploader:
        class: AppBundle\Uploader\ImageUploader
        arguments: [ "@app.sylius.image_uploader.config" ]
    app.sylius.image_uploader.config:
        class: 'Gaufrette\Filesystem'
        factory: [ "@knp_gaufrette.filesystem_map", get ]
        arguments: [ 'sylius_image' ]

If you add a new filesystem to gaufrette, don't forget to update conf

knp_gaufrette:
    adapters:
        sylius_image:
            aws_s3:
                service_id: app.amazon_s3
                bucket_name:  "%amazon_s3.bucket_name%"
                options:
                    directory: '%amazon_s3_folder_pictures%'
    filesystems:
        sylius_image:
            adapter: sylius_image