Skip to content

Commit a1a2ef5

Browse files
mvanbaakcjyclaire
authored andcommitted
Support silex 2 / pimple (#12)
* Support silex 2 / pimple * Document silex and this provider versions Since silex 2 / pimple 3 providers are not compatible with version 1 of silex, make sure to document it in the readme and point silex 1 users to the correct branch.
1 parent bfa73d1 commit a1a2ef5

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
[![Latest Stable Version](https://poser.pugx.org/aws/aws-sdk-php-silex/v/stable.png)](https://packagist.org/packages/aws/aws-sdk-php-silex)
66
[![Total Downloads](https://poser.pugx.org/aws/aws-sdk-php-silex/downloads.png)](https://packagist.org/packages/aws/aws-sdk-php-silex)
77

8-
A simple Silex service provider for including the [AWS SDK for PHP](https://github.com/aws/aws-sdk-php).
8+
A simple Silex 2 / Pimple 3 service provider for including the [AWS SDK for PHP](https://github.com/aws/aws-sdk-php).
9+
10+
note:
11+
If you are using the 1.x Silex version, Use [version 2.x]
12+
(https://github.com/aws/aws-sdk-php-silex/tree/2.0) of this provider.
913

1014
## Installation
1115

@@ -15,7 +19,7 @@ The AWS Service Provider can be installed via [Composer](http://getcomposer.org)
1519
```json
1620
{
1721
"require": {
18-
"aws/aws-sdk-php-silex": "~2.0"
22+
"aws/aws-sdk-php-silex": "~3.0"
1923
}
2024
}
2125
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"require": {
1515
"php": ">=5.5",
1616
"aws/aws-sdk-php": "~3.0",
17-
"silex/silex": "1.*"
17+
"silex/silex": "^2.0"
1818
},
1919
"autoload": {
2020
"psr-4": {
@@ -28,7 +28,7 @@
2828
},
2929
"extra": {
3030
"branch-alias": {
31-
"dev-master": "2.0-dev"
31+
"dev-master": "3.0-dev"
3232
}
3333
},
3434
"require-dev": {

src/AwsServiceProvider.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,26 @@
1717
namespace Aws\Silex;
1818

1919
use Aws\Sdk;
20+
use Pimple\Container;
21+
use Pimple\ServiceProviderInterface;
2022
use Silex\Application;
21-
use Silex\ServiceProviderInterface;
2223

2324
/**
2425
* AWS SDK for PHP service provider for Silex applications
2526
*/
2627
class AwsServiceProvider implements ServiceProviderInterface
2728
{
28-
const VERSION = '2.0.2';
29+
const VERSION = '3.0.0';
2930

30-
public function register(Application $app)
31+
public function register(Container $container)
3132
{
32-
$app['aws'] = $app->share(function (Application $app) {
33-
$config = isset($app['aws.config']) ? $app['aws.config'] : [];
33+
$container['aws'] = function (Application $container) {
34+
$config = isset($container['aws.config']) ? $container['aws.config'] : [];
3435

3536
return new Sdk($config + ['ua_append' => [
3637
'Silex/' . Application::VERSION,
3738
'SXMOD/' . self::VERSION,
3839
]]);
39-
});
40-
}
41-
42-
public function boot(Application $app)
43-
{
40+
};
4441
}
4542
}

tests/AwsServiceProviderTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function testRegisterAwsServiceProvider()
3838
],
3939
)
4040
));
41-
$provider->boot($app);
4241

4342
// Get an instance of a client (S3) to use for testing
4443
$s3 = $app['aws']->createS3();
@@ -66,7 +65,6 @@ public function testNoConfigProvided()
6665
],
6766
)
6867
));
69-
$provider->boot($app);
7068

7169
// Instantiate a client, which should trigger an exception for missing configs
7270
$s3 = $app['aws']->createS3();

0 commit comments

Comments
 (0)