KnpGaufretteBundle icon indicating copy to clipboard operation
KnpGaufretteBundle copied to clipboard

Add README and instructions about AmazonS3 usage

Open bitomule opened this issue 11 years ago • 11 comments

Hi, I'm trying to use Amazon S3 as filesystem using KnpGaufretteBundle but I don't understand how to do it and readme doesn't show anything about S3. Could anyone explain me what should I do? :(

Thanks!

bitomule avatar Sep 11 '12 11:09 bitomule

Hello, thanks for information. Will try to update README with some examples, right now open issue to remember about that.

l3l0 avatar Sep 11 '12 16:09 l3l0

+1

vwasteels avatar Jan 04 '13 00:01 vwasteels

I think there is an issue with composer. I have this configuration:

"require": {
        ...
        "knplabs/knp-gaufrette-bundle": "dev-master"
    },

but it looks like the vendor amazonwebservices/aws-sdk-for-php or aws/aws-sdk-php (not sure which version is used here) is not downloading ending up not finding the required AmazonS3 class to setup the service.

Here is my gaufrette configuration:

# app/config/config.yml
knp_gaufrette:
    adapters:
        amazon:
            amazon_s3:
                amazon_s3_id: service.amazon.s3
                bucket_name: %amazon.bucket%
                create: true

    filesystems:
        amazon:
            adapter: amazon

    stream_wrapper:
        protocol: data
# Acme/DemoBundle/Resources/config/service.yml
services:
    service.amazon.s3:
        class: AmazonS3 # I've tried "Amazon" too
        arguments: [%amazon.key%, %amazon.secret%, %amazon.token%]
# app/config/paramters.yml
parameters:
    amazon.key: "s3 application key"
    amazon.secret: "s3 secret key"
    amazon.token: "never used a token before, I guess it's from oAuth"
    amazon.bucket: "the bucket you want to use"

And with this setup I get:

" Class 'AmazonS3' not found" or " Class 'Amazon' not found"

UPDATE:

So it was what I was thinking Gaufrette is not downloading the amazon module automatically, you need to add it in your composer.json (would it be possible to add it in the composer.json of Gaufrette directly?):

"require": {
        ...
        "knplabs/knp-gaufrette-bundle": "dev-master",
        "amazonwebservices/aws-sdk-for-php" : "*"
    },

After updating composer (php composer.phar update) everything is working. To save a file on Amazon (into a controller) just use the following code:

// Get the defined filesystem
$filesystem = $this->get('knp_gaufrette.filesystem_map')->get('amazon');

// write the file
$filesystem->write('maxime/test.txt' , 'my test', true);

Maxwell2022 avatar Feb 12 '13 22:02 Maxwell2022

We do not want add amazonwebservices/aws-sdk-for-php directly cause it is optional dependency. We have it in suggest composer block so it should be printed when you run composer install IIRC https://github.com/KnpLabs/Gaufrette/blob/master/composer.json#L55

l3l0 avatar Feb 13 '13 08:02 l3l0

We should add this in the documentation section to setup AWS S3 filesystem. Actually we should move the documentation in the Resources/doc and organise it by file. One file per filesystem, configuration + exemple would be great.

What do you think ?

Maxwell2022 avatar Feb 13 '13 08:02 Maxwell2022

:+1: for more documentation an especially the S3 setup. Thanks for this Bundle!

bicpi avatar Mar 05 '13 15:03 bicpi

+1 for S3 setup

pierre-b avatar May 08 '13 21:05 pierre-b

+1 for S3 setup

jeromeschneider avatar May 14 '13 20:05 jeromeschneider

+1 for S3 setup. It's pretty confusing right now. Especially with the required CA but no information about that.

Fraktl avatar May 16 '13 11:05 Fraktl

Well, this issue is almost three years old. So, how do you feel guys, is the docs in https://github.com/KnpLabs/KnpGaufretteBundle#amazon-s3-amazon_s3 enough for the moment? Should we update it? What are you missing in the current doc? Thanks in advance.

akovalyov avatar Jan 16 '16 01:01 akovalyov

:+1:

mappedinn avatar Jan 18 '16 04:01 mappedinn

I close this issue. As mentioned by @akovalyov, a documentation is available. Please feel free to reopen it if necessary.

KevinArtus avatar Apr 13 '23 14:04 KevinArtus