Skip to content

Commit ddc64ed

Browse files
add a Lumen example
1 parent d4e5267 commit ddc64ed

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ return [
9090
],
9191
'region' => env('AWS_REGION', 'us-east-1'),
9292
'version' => 'latest',
93-
93+
9494
// You can override settings for specific services
9595
'Ses' => [
9696
'region' => 'us-east-1',
@@ -109,7 +109,7 @@ the SDK's User Guide.
109109
## Usage
110110

111111
In order to use the AWS SDK for PHP within your app, you need to retrieve it from the [Laravel Service
112-
Container](https://laravel.com/docs/container#binding). The following example uses the Amazon S3 client to upload a file.
112+
Container](https://laravel.com/docs/container#binding). The following example uses the Amazon S3 client to upload a file (in the full Laravel framework).
113113

114114
```php
115115
$s3 = App::make('aws')->createClient('s3');
@@ -121,7 +121,7 @@ $s3->putObject(array(
121121
```
122122

123123
If the AWS facade is registered within the `aliases` section of the application configuration, you can also use the
124-
following technique.
124+
following technique (in the full Laravel framework).
125125

126126
```php
127127
$s3 = AWS::createClient('s3');
@@ -132,6 +132,17 @@ $s3->putObject(array(
132132
));
133133
```
134134

135+
To use in Lumen, you need to retrieve it from the service container a bit differently:
136+
137+
```php
138+
$s3 = app('aws')->createClient('s3');
139+
$s3->putObject(array(
140+
'Bucket' => 'YOUR_BUCKET',
141+
'Key' => 'YOUR_OBJECT_KEY',
142+
'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
143+
));
144+
```
145+
135146
## Links
136147

137148
* [AWS SDK for PHP on Github](http://github.com/aws/aws-sdk-php/)

0 commit comments

Comments
 (0)