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

0.1.2 2024-06-13 00:37 UTC

This package is auto-updated.

Last update: 2025-11-13 03:48:43 UTC


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"
  }
}