forked from async-aws/aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docs for SimpleS3 (async-aws#657)
* Added docs for SimpleS3 * minor
- Loading branch information
Showing
4 changed files
with
43 additions
and
1 deletion.
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
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,37 @@ | ||
--- | ||
category: integration | ||
--- | ||
|
||
# Simple S3 client | ||
|
||
An abstraction layer above the S3Client that provides simpler functions to common | ||
tasks. The client will automatically switch to multipart upload for large files. | ||
|
||
## Install | ||
|
||
```shell | ||
composer require async-aws/simple-s3 | ||
``` | ||
|
||
## Usage | ||
|
||
```php | ||
use AsyncAws\SimpleS3\SimpleS3Client; | ||
|
||
$s3 = new SimpleS3Client(); | ||
$resource = \fopen('/path/to/cat/image.jpg', 'r'); | ||
$s3->upload('my-image-bucket', 'photos/cat_2.jpg', $resource); | ||
$s3->upload('my-image-bucket', 'photos/cat_2.txt', 'I like this cat'); | ||
|
||
// Check if a file exists | ||
$s3->has('my-image-bucket', 'photos/cat_2.jpg'); // true | ||
|
||
// Get file URL | ||
$url = $s3->getUrl('my-image-bucket', 'photos/cat_2.jpg'); | ||
echo $url; // https://my-image-bucket.s3.eu-central-1.amazonaws.com/photos/cat_2.jpg | ||
|
||
// Download a file | ||
$resource = $s3->download('my-image-bucket', 'photos/cat_2.jpg')->getContentAsResource(); | ||
$text = $s3->download('my-image-bucket', 'photos/cat_2.txt')->getContentAsString(); | ||
echo $text; // I like this cat | ||
``` |
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