Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
PawnKaiser committed Jan 23, 2016
1 parent b54e8be commit dd884be
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 5 deletions.
36 changes: 32 additions & 4 deletions README.md
Expand Up @@ -18,9 +18,35 @@ This bundle uses the latest [AWS SDK for PHP](http://github.com/amazonwebservice

For installation, configuration, and usage details, please see [`Resources/doc/README.md`](https://github.com/ThePhalcons/AmazonWebServicesBundle/blob/master/Resources/doc/README.md)

Changelog
---------
PR#15 submitted by @Fran6co requires a type chnage to the enable_extensions parameter in config.yml. See step 5b of [Resources/doc/README.md`](https://github.com/ThePhalcons/AmazonWebServicesBundle/blob/master/Resources/doc/README.md) for the new format.

## Resources

* [Get started] – For getting started usage information
* [Sample Project][sdk-sample] - A quick, sample project to help get you started
* [Issues][sdk-issues] – Report issues, submit pull requests, and get involved
(see [Apache 2.0 License][sdk-license])

## Features

* Provides easy-to-use HTTP clients for all supported AWS
[services][docs-services], [regions][docs-rande], and authentication
protocols.
* Is built on [Guzzle][guzzle-docs], and utilizes many of its features,
including persistent connections, asynchronous requests, middlewares, etc.
* Provides convenience features including easy result pagination via
[Paginators][docs-paginators], [Waiters][docs-waiters], and simple
[Result objects][docs-results].
* Provides a [multipart uploader tool][docs-s3-multipart] for Amazon S3 and
Amazon Glacier that can be paused and resumed.
* Provides an [Amazon S3 Stream Wrapper][docs-streamwrapper], so that you can
use PHP's native file handling functions to interact with your S3 buckets and
objects like a local filesystem.
* Provides the [Amazon DynamoDB Session Handler][docs-ddbsh] for easily scaling
sessions on a fast, NoSQL database.
* Automatically uses [IAM Instance Profile Credentials][aws-iam-credentials] on
configured Amazon EC2 instances.



Example Use Cases
-----------------
Expand All @@ -35,4 +61,6 @@ License

This bundle is under the MIT license. See the complete license in the bundle:

Resources/meta/LICENSE
Resources/meta/LICENSE

[Get started]: <https://github.com/ThePhalcons/AmazonWebServicesBundle/blob/dev-master/Resources/doc/README.md>
65 changes: 65 additions & 0 deletions Resources/doc/Samples
@@ -0,0 +1,65 @@

## Quick Examples

### Create an Amazon S3 client

```php

/**
* @Route("/aws/test", name="_demo")
* @Template()
*/
public function indexAction()
{

/** @var S3Client $s3 */
$s3 = $this->container->get('aws_s3');

}

```

### Send file to a bucket

```php
/**
* send file to aws a bucket
* @param $absolutePath String locale file
* @param $awsTargetPath String aws targetPath
* @return \Aws\Result
* @throws \NotFoundBucket
*/
public function multipartUploader($absolutePath, $awsTargetPath)
{
$bucket = 'my_bucket_name';

$uploader = new MultipartUploader($this->s3, $absoluteFilePath, [
'bucket' => $absolutePath,
'key' => $awsTargetPath,
]);


do {
try {
$result = $uploader->upload();
} catch (MultipartUploadException $e) {
$uploader = new MultipartUploader($this->s3, $absoluteFilePath, [
'state' => $e->getState(),
]);
}
} while (!isset($result));

try {
$result = $uploader->upload();
return $result;
} catch (MultipartUploadException $e) {
throw $e;
}
}
```

### Send email using SES

[SES Mailing sevice]

[SES Mailing sevice]: <https://github.com/ThePhalcons/AmazonWebServicesBundle/blob/dev-master/Services/SESMailingService.php>
35 changes: 34 additions & 1 deletion Resources/doc/todo.md
Expand Up @@ -4,5 +4,38 @@

2. Integrate the cloudfusion AmazonPAS functionality

3. Condense/Consolidate the Factory and service instantiation
3. update documentation

4. Using credentials from environment variables, credentials profiles or env provider

```
$this->sdk = new Sdk(
array(
'region' => $this->getRegion(),
// use specific aws sdk php version or latest version if not defined
'version' => ($this->getVersion() != '' ) ? $this->getVersion() : 'latest',
'credentials' => CredentialProvider::env()
)
);
//instead of
$credentials = new Credentials($this->getKey(), $this->getSecret());
// it's more bette to use Credentials provide.
// possibility to use memorize function which will cache your credentials
// and optimize performances
$this->sdk = new Sdk(
array(
'region' => $this->getRegion(),
// use specific aws sdk php version or latest version if not defined
'version' => ($this->getVersion() != '' ) ? $this->getVersion() : 'latest',
'credentials' => $credentials
)
);
```

1 change: 1 addition & 0 deletions Services/StorageService.php
Expand Up @@ -154,6 +154,7 @@ private function deleteObject($bucket, $awsPath){
}

/**
* send file to aws bucket
* @param $absolutePath String locale file
* @param $awsTargetPath String aws targetPath
* @return \Aws\Result
Expand Down

0 comments on commit dd884be

Please sign in to comment.