SDK for PHP 3.x

Transfer
in package
implements PromisorInterface

Transfers files from the local filesystem to S3 or from S3 to the local filesystem.

This class does not support copying from the local filesystem to somewhere else on the local filesystem or from one S3 bucket to another.

Table of Contents

Interfaces

PromisorInterface
Interface used with classes that return a promise.

Methods

__construct()  : mixed
When providing the $source argument, you may provide a string referencing the path to a directory on disk to upload, an s3 scheme URI that contains the bucket and key (e.g., "s3://bucket/key"), or an \Iterator object that yields strings containing filenames that are the path to a file on disk or an s3 scheme URI. The bucket portion of the s3 URI may be an S3 access point ARN. The "/key" portion of an s3 URI is optional.
promise()  : PromiseInterface
Transfers the files.
transfer()  : mixed
Transfers the files synchronously.

Methods

__construct()

When providing the $source argument, you may provide a string referencing the path to a directory on disk to upload, an s3 scheme URI that contains the bucket and key (e.g., "s3://bucket/key"), or an \Iterator object that yields strings containing filenames that are the path to a file on disk or an s3 scheme URI. The bucket portion of the s3 URI may be an S3 access point ARN. The "/key" portion of an s3 URI is optional.

public __construct(S3ClientInterface $client, string|Iterator $source, string $dest[, array<string|int, mixed> $options = [] ]) : mixed

When providing an iterator for the $source argument, you must also provide a 'base_dir' key value pair in the $options argument.

The $dest argument can be the path to a directory on disk or an s3 scheme URI (e.g., "s3://bucket/key").

The options array can contain the following key value pairs:

  • base_dir: (string) Base directory of the source, if $source is an iterator. If the $source option is not an array, then this option is ignored.
  • before: (callable) A callback to invoke before each transfer. The callback accepts a single argument: Aws\CommandInterface $command. The provided command will be either a GetObject, PutObject, InitiateMultipartUpload, or UploadPart command.
  • mup_threshold: (int) Size in bytes in which a multipart upload should be used instead of PutObject. Defaults to 20971520 (20 MB).
  • concurrency: (int, default=5) Number of files to upload concurrently. The ideal concurrency value will vary based on the number of files being uploaded and the average size of each file. Generally speaking, smaller files benefit from a higher concurrency while larger files will not.
  • debug: (bool) Set to true to print out debug information for transfers. Set to an fopen() resource to write to a specific stream rather than writing to STDOUT.
Parameters
$client : S3ClientInterface

Client used for transfers.

$source : string|Iterator

Where the files are transferred from.

$dest : string

Where the files are transferred to.

$options : array<string|int, mixed> = []

Hash of options.

transfer()

Transfers the files synchronously.

public transfer() : mixed
On this page