Skip to content

Instantly share code, notes, and snippets.

@ylastapis
Created May 23, 2016 09:23
Show Gist options
  • Save ylastapis/e392ac72543504b05b8a332a935e8b9c to your computer and use it in GitHub Desktop.
Save ylastapis/e392ac72543504b05b8a332a935e8b9c to your computer and use it in GitHub Desktop.
AWS 3 with Symfony2 and Gaufrette
{
"require": {
"knplabs/gaufrette": "dev-master",
"knplabs/knp-gaufrette-bundle": "dev-master",
"aws/aws-sdk-php": "dev-master"
}
}
knp_gaufrette:
adapters:
sylius_image:
aws_s3:
service_id: app.amazon_s3
bucket_name: "%amazon_s3.bucket_name%"
app:
amazon_s3:
key: "%amazon_s3.key%"
secret: "%amazon_s3.secret%"
region: "%amazon_s3.region%"
version: "%amazon_s3.version%"
bucket_name: "%amazon_s3.bucket_name%"
<?php
namespace AppBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('app');
$rootNode
->children()
->arrayNode('amazon_s3')
->children()
->scalarNode('key')->defaultValue('EDITME')->end()
->scalarNode('secret')->defaultValue('EDITME')->end()
->scalarNode('region')->defaultValue('YOUR_BUCKET_REGION')->end()
->scalarNode('version')->defaultValue('2006-03-01')->end()
->scalarNode('bucket_name')->defaultValue('YOUR_BUCKET_NAME')->end()
->end()
->end()
->end();
return $treeBuilder;
}
}
# This file is auto-generated during the composer install
parameters:
amazon_s3.key: EDITME
amazon_s3.secret: EDITME
amazon_s3.region: YOUR_BUCKET_REGION
amazon_s3.version: '2006-03-01'
amazon_s3.bucket_name: YOUR_BUCKET_NAME
services:
app.amazon_s3:
class: Aws\S3\S3Client
factory: [ Aws\S3\S3Client , factory]
arguments:
-
region: "%amazon_s3.region%"
version: "%amazon_s3.version%"
credentials:
key: "%amazon_s3.key%"
secret: "%amazon_s3.secret%"
@ylastapis
Copy link
Author

Update of https://gist.github.com/phpfour/6533329 with latest AWS 3 SDK (changed from amazonwebservices/aws-sdk-for-php to aws/aws-sdk-php)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment