mvbcoding/aws-sdk-php-v3-bridge-silex

A simple Silex service provider for including the AWS SDK v3 bridge for PHP.

3.0.0 2016-05-22 16:23 UTC

This package is auto-updated.

Last update: 2024-03-29 03:23:24 UTC


README

Latest Stable Version Total Downloads License SensioLabsInsight Codeship build status

A simple Silex service provider for including the AWS SDK for PHP - Version 3 Upgrade Bridge.

Installation

The AWS Service Provider can be installed via Composer by requiring the mvbcoding/aws-sdk-php-v3-bridge-silex package in your project's composer.json.

{
    "require": {
        "mvbcoding/aws-sdk-php-v3-bridge-silex": "^3.0"
    }
}

Usage

Register the AWS Service Provider in your Silex application and provide your AWS SDK for PHP configuration to the app in the aws.config key. $app['aws.config'] should contain an array of configuration options or the path to a configuration file. This value is passed directly into new Aws\SimpleDb\SimpleDbClient.

<?php

require __DIR__ . '/vendor/autoload.php';

use MvbCoding\Silex\AwsV3BridgeServiceProvider;
use Silex\Application;

$app = new Application();

$app->register(new AwsV3BridgeServiceProvider(), array(
    'aws.config' => array(
        'version' => 'latest',
        'region' => 'eu-west-1',
    )
));

$app->match('/', function () use ($app) {
    // Create a list of your SimpleDb Domains
    $domains = $app['aws.simpledb']->listDomains();
    $output = "<ul>\n";
    foreach ($domains['DomainNames'] as $domain) {
        $output .= "<li>{$domain}</li>\n";
    }
    $output .= "</ul>\n";

    return $output;
});

$app->run();

Links