Skip to content

Commit

Permalink
Fixed composer.json requirements and brought module up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremeamia committed Nov 12, 2013
1 parent 14aee8e commit 73da7df
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -8,15 +8,13 @@ A simple Silex service provider for including the [AWS SDK for PHP](https://gith
## Installation

The AWS Service Provider can be installed via [Composer](http://getcomposer.org) by requiring the
`aws/aws-sdk-php-silex` package and setting the `minimum-stability` to `dev` (required for Silex) in your project's
`composer.json`.
`aws/aws-sdk-php-silex` package in your project's `composer.json`.

```json
{
"require": {
"aws/aws-sdk-php-silex": "1.*"
},
"minimum-stability": "dev"
}
}
```

Expand Down Expand Up @@ -52,7 +50,7 @@ $app->match('/', function () use ($app) {

// Create a list of the buckets in your account
$output = "<ul>\n";
foreach ($s3->getIterator('ListBuckets') as $bucket) {
foreach ($s3->getListBucketsIterator() as $bucket) {
$output .= "<li>{$bucket['Name']}</li>\n";
}
$output .= "</ul>\n";
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Expand Up @@ -13,10 +13,9 @@
],
"require": {
"php": ">=5.3.3",
"aws/aws-sdk-php": "~2.0",
"silex/silex": "~1.0"
"aws/aws-sdk-php": "2.*",
"silex/silex": "1.*"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": { "Aws\\Silex": "src/" }
},
Expand Down
11 changes: 4 additions & 7 deletions src/Aws/Silex/AwsServiceProvider.php
Expand Up @@ -28,9 +28,8 @@
*/
class AwsServiceProvider implements ServiceProviderInterface
{
/**
* @inheritdoc
*/
const VERSION = '1.1.0';

public function register(Application $app)
{
$app['aws'] = $app->share(function (Application $app) {
Expand All @@ -42,18 +41,16 @@ public function register(Application $app)
$aws->getEventDispatcher()->addListener('service_builder.create_client', function (Event $event) {
$clientConfig = $event['client']->getConfig();
$commandParams = $clientConfig->get(Client::COMMAND_PARAMS) ?: array();
$userAgentData = 'Silex/' . Application::VERSION . ' SXMOD/' . AwsServiceProvider::VERSION;
$clientConfig->set(Client::COMMAND_PARAMS, array_merge_recursive($commandParams, array(
UserAgentListener::OPTION => 'Silex/' . Application::VERSION
UserAgentListener::OPTION => $userAgentData
)));
});

return $aws;
});
}

/**
* @inheritdoc
*/
public function boot(Application $app)
{
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Aws/Silex/Tests/AwsServiceProviderTest.php
Expand Up @@ -50,7 +50,7 @@ public function testRegisterAwsServiceProvider()
$command = $s3->getCommand('ListBuckets');
$request = $command->prepare();
$s3->dispatch('command.before_send', array('command' => $command));
$this->assertRegExp('/.+Silex\/.+/', $request->getHeader('User-Agent', true));
$this->assertRegExp('/.+Silex\/.+/', (string) $request->getHeader('User-Agent'));
}

/**
Expand Down

0 comments on commit 73da7df

Please sign in to comment.