-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b54e8be
commit dd884be
Showing
4 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters