Skip to content

Commit 9caa867

Browse files
committed
Added some more to the README and added some headers to better organize the content.
1 parent 8f7b750 commit 9caa867

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ project's `composer.json`.
2020

2121
## Usage
2222

23-
First you have to register the AWS Service Provider when bootstraping your Laravel application. Create a new `app/config/aws.php` configuration file with the following options.
23+
To use the AWS Service Provider, you must register the provider when bootstrapping your Laravel application. There are
24+
essentially two ways to do this.
25+
26+
### 1. Use Laravel Configuration
27+
28+
Create a new `app/config/aws.php` configuration file with the following options:
2429

2530
```php
2631
return array(
@@ -30,7 +35,7 @@ return array(
3035
);
3136
```
3237

33-
Now find the `providers` key in `app/config/app.php` and register the AWS Service Provider.
38+
Find the `providers` key in `app/config/app.php` and register the AWS Service Provider.
3439

3540
```php
3641
'providers' => array(
@@ -42,17 +47,21 @@ Now find the `providers` key in `app/config/app.php` and register the AWS Servic
4247
)
4348
```
4449

45-
Or if you'd like to register the configuration options at runtime.
50+
### 2. Manual Instantiation
51+
52+
You can also register the provider and configuration options at runtime. This could be done in your global bootstrapping
53+
process in `app/start/global.php`.
4654

4755
```php
4856
use Aws\Common\Enum\Region;
4957
use Aws\Laravel\AwsServiceProvider;
5058
use Illuminate\Foundation\Application;
5159

52-
// Instantiate a new application. This is done by the Laravel framework and the instance is available
53-
// in app/start/global.php for you to use.
60+
// Instantiate a new application. This is normally done by the Laravel framework and the instance is available in
61+
// `app/start/global.php` for you to use.
5462
$app = new Application;
5563

64+
// Register the AWS service provider and provide your configuration
5665
$app->register(new AwsServiceProvider($app), array(
5766
'config' => array(
5867
'aws' => array(
@@ -64,23 +73,25 @@ $app->register(new AwsServiceProvider($app), array(
6473
));
6574
```
6675

67-
*Or* you can specify the path to an AWS config file (see [AWS SDK for PHP](http://github.com/aws/aws-sdk-php) for
68-
details).
76+
You can alternatively specify the path to an AWS config file (see [AWS SDK for PHP
77+
](http://github.com/aws/aws-sdk-php) for details about how to format this type of file).
6978

7079
```php
7180
$app->register(new AwsServiceProvider($app), array('config' => array('aws' => '/path/to/aws/config/file.php')));
7281
```
7382

7483
Either way, the value of `$app['config']['aws']` is passed directly into `Aws\Common\Aws::factory()`.
7584

85+
### Retrieving and Using a Service Client
86+
7687
In order to use the SDK from within your app, you need to retrieve it from the [Laravel IoC
77-
Container](http://four.laravel.com/docs/ioc).
88+
Container](http://four.laravel.com/docs/ioc). The following example uses the Amazon S3 client to upload a file.
7889

7990
```php
8091
$s3 = App::make('aws')->get('s3');
8192
$s3->putObject(array(
8293
'Bucket' => '<your-bucket>',
83-
'Key' => 'the-name-of-your-object',
94+
'Key' => '<the-name-of-your-object>',
8495
'SourceFile' => '/path/to/the/file/you/are/uploading.ext',
8596
));
8697
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy