ObjectUploader
in package
implements
PromisorInterface
Uploads an object to S3, using a PutObject command or a multipart upload as appropriate.
Interfaces, Classes and Traits
- PromisorInterface
- Interface used with classes that return a promise.
Table of Contents
- DEFAULT_MULTIPART_THRESHOLD = 16777216
- $acl : mixed
- $body : mixed
- $bucket : mixed
- $client : mixed
- $defaults : mixed
- $key : mixed
- $options : mixed
- __construct() : mixed
- promise() : PromiseInterface
- Returns a promise.
- upload() : mixed
- requiresMultipart() : bool
- Determines if the body should be uploaded using PutObject or the Multipart Upload System. It also modifies the passed-in $body as needed to support the upload.
Constants
DEFAULT_MULTIPART_THRESHOLD
public
mixed
DEFAULT_MULTIPART_THRESHOLD
= 16777216
Properties
$acl
private
mixed
$acl
$body
private
mixed
$body
$bucket
private
mixed
$bucket
$client
private
mixed
$client
$defaults
private
static mixed
$defaults
= ['before_upload' => null, 'concurrency' => 3, 'mup_threshold' => self::DEFAULT_MULTIPART_THRESHOLD, 'params' => [], 'part_size' => null]
$key
private
mixed
$key
$options
private
mixed
$options
Methods
__construct()
public
__construct(S3ClientInterface $client, string $bucket, string $key, mixed $body[, string $acl = 'private' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $client : S3ClientInterface
-
The S3 Client used to execute the upload command(s).
- $bucket : string
-
Bucket to upload the object, or an S3 access point ARN.
- $key : string
-
Key of the object.
- $body : mixed
-
Object data to upload. Can be a StreamInterface, PHP stream resource, or a string of data to upload.
- $acl : string = 'private'
-
ACL to apply to the copy (default: private).
- $options : array<string|int, mixed> = []
-
Options used to configure the copy process. Options passed in through 'params' are added to the sub command(s).
Return values
mixed —promise()
Returns a promise.
public
promise() : PromiseInterface
Return values
PromiseInterface —upload()
public
upload() : mixed
Return values
mixed —requiresMultipart()
Determines if the body should be uploaded using PutObject or the Multipart Upload System. It also modifies the passed-in $body as needed to support the upload.
private
requiresMultipart(StreamInterface &$body, int $threshold) : bool
Parameters
- $body : StreamInterface
-
Stream representing the body.
- $threshold : int
-
Minimum bytes before using Multipart.