tonitin / post-s3
Upload direct to s3
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tonitin/post-s3
Requires
- aws/aws-sdk-php: ^3.314
README
This library allows you to quickly create the post signed request for S3, from the database models.
First Step
- Includes trait S3PostSigned in your model
use S3PostSigned;
Here's an example of using createPostSigned method:
$post = new Post(); $sizeBytes = 80000; $bucketName = 'example'; $key = 'xyz/abc/horse.mp3'; $postSigned = $post->createPostSigned($bucketName, $key, $sizeBytes);
Example response
{
"formAttributes": {
"action": "endpointUrl",
"method": "POST",
"enctype": "multipart/form-data"
},
"formInputs": {
"key": "xyz/abc/horse.mp3",
"X-Amz-Credential": "xxxxxxxxx",
"X-Amz-Algorithm": "xxxxxxxxx",
"X-Amz-Date": "xxxxxxxxxxxxxxxxxxxxxxxx",
"Policy": "xxxxxxxxxxxxxxxxxxxxxxxx",
"X-Amz-Signature": "xxxxxxxxxxxxxxxxxxxxxxxx"
}
}