obtao/amazon-webservices-bundle

A Symfony2 Bundle for interfacing with Amazon Web Services (AWS)

0.0.3 2015-11-10 14:52 UTC

This package is not auto-updated.

Last update: 2024-10-26 18:17:24 UTC


README

Overview

This is a Symfony2 Bundle for interfacing with Amazon Web Services (AWS).

This bundle uses the AWS SDK for PHP by loading the SDK, and enabling you to instantiate the SDK's various web service objects, passing them back to you for direct use in your Symfony2 application..

Installation

Add this line to your composer.json file:

"require": {
    ...,
    "obtao/amazon-webservices-bundle": "*@stable"
}

Then run composer update.

Then, add AmazonWebServicesBundle to your application kernel:

<?php

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Obtao\AmazonWebServicesBundle\ObtaoAmazonWebServicesBundle(),
        // ...
    );
}

Configuration

You can add the following default configuration to the config.yml file :

# app/config/config.yml
obtao_amazon_web_services:
    key:                        YOUR_KEY
    secret:                     YOUR_SECRET
    region:                     YOUR_REGION

Usage

Once installed, you simply need to request the appropriate service for the Amazon Web Service object you wish to use. The returned object will then allow you full access the the API for the requested service.

Please see the AWS SDK for PHP documentation for a list of each service's API calls.

In this example, we get an AmazonSQS object from the AWS SDK for PHP library by requesting the obtao.aws_sqs service. We then use that object to retrieve a message from an existing Amazon SQS queue.

<?php

// in a controller
public function someAction()
{
    // get the Simple Queue Service
    $awsSQS = $this->container->get('obtao.aws_sqs');

    // do something
}

Available Services

The following services are available, each returning an object allowing access to the respective Amazon Web Service

More documentation