From 73da7df3e07262b8b6b75f558a3e27ffe1f49acc Mon Sep 17 00:00:00 2001 From: Jeremy Lindblom Date: Tue, 12 Nov 2013 09:51:32 -0800 Subject: [PATCH] Fixed composer.json requirements and brought module up-to-date --- README.md | 8 +++----- composer.json | 5 ++--- src/Aws/Silex/AwsServiceProvider.php | 11 ++++------- tests/Aws/Silex/Tests/AwsServiceProviderTest.php | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 67c9ded..645f680 100644 --- a/README.md +++ b/README.md @@ -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" + } } ``` @@ -52,7 +50,7 @@ $app->match('/', function () use ($app) { // Create a list of the buckets in your account $output = "\n"; diff --git a/composer.json b/composer.json index 6e87bd2..6630be1 100644 --- a/composer.json +++ b/composer.json @@ -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/" } }, diff --git a/src/Aws/Silex/AwsServiceProvider.php b/src/Aws/Silex/AwsServiceProvider.php index 759eabb..9b76d1a 100644 --- a/src/Aws/Silex/AwsServiceProvider.php +++ b/src/Aws/Silex/AwsServiceProvider.php @@ -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) { @@ -42,8 +41,9 @@ 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 ))); }); @@ -51,9 +51,6 @@ public function register(Application $app) }); } - /** - * @inheritdoc - */ public function boot(Application $app) { } diff --git a/tests/Aws/Silex/Tests/AwsServiceProviderTest.php b/tests/Aws/Silex/Tests/AwsServiceProviderTest.php index 7f6ff79..dc19118 100644 --- a/tests/Aws/Silex/Tests/AwsServiceProviderTest.php +++ b/tests/Aws/Silex/Tests/AwsServiceProviderTest.php @@ -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')); } /**