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
Requires
- php: >=5.5
- aws/aws-sdk-php-v3-bridge: ^0.2.0
- silex/silex: ^2.0
Requires (Dev)
- phpunit/phpunit: ^5.3
- squizlabs/php_codesniffer: ^2.6
README
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();