Represents an AWS client.
Table of Contents MethodsCreates and executes a command for an operation by name.
public __call(string $name, array<string|int, mixed> $arguments) : ResultInterface
Suffixing an operation name with "Async" will return a promise that can be used to execute commands asynchronously.
ParametersName of the command to execute.
Arguments to pass to the getCommand method.
Copy an object of any size to a different location.
public copy(string $fromBucket, string $fromKey, string $destBucket, string $destKey[, string $acl = 'private' ][, array<string|int, mixed> $options = [] ]) : ResultInterface
If the upload size exceeds the maximum allowable size for direct S3 copying, a multipart copy will be used.
The options array accepts the following options:
function (Aws\Command $command) {...}
.UploadPart
operations allowed during a multipart upload.CopyObject
operation. For multipart uploads, they correspond to the parameters of the CreateMultipartUpload
operation.Bucket where the copy source resides.
Key of the copy source.
Bucket to which to copy the object.
Key to which to copy the object.
ACL to apply to the copy (default: private).
Options used to configure the upload process.
for more info about multipart uploads.
Returns the result of the copy.
copyAsync()Copy an object of any size to a different location asynchronously.
public copyAsync(string $fromBucket, string $fromKey, string $destBucket, string $destKey[, string $acl = 'private' ][, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
Bucket where the copy source resides.
Key of the copy source.
Bucket to which to copy the object.
Key to which to copy the object.
ACL to apply to the copy (default: private).
Options used to configure the upload process.
for more info about the parameters above.
Returns a promise that will be fulfilled with the result of the copy.
createPresignedRequest()Create a pre-signed URL for the given S3 command object.
public createPresignedRequest(CommandInterface $command, int|string|DateTimeInterface $expires[, array<string|int, mixed> $options = [] ]) : RequestInterface
Parameters
Command to create a pre-signed URL for.
The time at which the URL should expire. This can be a Unix timestamp, a PHP DateTime object, or a string that can be evaluated by strtotime().
Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you to do things like delete all objects that match a specific key prefix.
public deleteMatchingObjects(string $bucket[, string $prefix = '' ][, string $regex = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
Bucket that contains the object keys
Optionally delete only objects under this key prefix
Delete only objects that match this regex
Aws\S3\BatchDelete options array.
if no prefix and no regex is given
Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you to do things like delete all objects that match a specific key prefix.
public deleteMatchingObjectsAsync(string $bucket[, string $prefix = '' ][, string $regex = '' ][, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
Bucket that contains the object keys
Optionally delete only objects under this key prefix
Delete only objects that match this regex
Aws\S3\BatchDelete options array.
A promise that is settled when matching objects are deleted.
determineBucketRegion()Returns the region in which a given bucket is located.
public determineBucketRegion(string $bucketName) : string
Parameters
Returns a promise fulfilled with the region in which a given bucket is located.
public determineBucketRegionAsync(string $bucketName) : PromiseInterface
Parameters
public doesBucketExist(string $bucket) : bool
Parameters
The name of the bucket
Use doesBucketExistV2() instead
Determines whether or not a bucket exists by name.
Determines whether or not a bucket exists by name. This method uses S3's HeadBucket operation and requires the relevant bucket permissions in the default case to prevent errors.
public doesBucketExistV2(string $bucket, bool $accept403) : bool
Parameters
The name of the bucket
Set to true for this method to return true in the case of invalid bucket-level permissions. Credentials MUST be valid to avoid inaccuracies. Using the default value of false will cause an exception to be thrown instead.
if there is an unhandled exception
public doesObjectExist(string $bucket, string $key[, array<string|int, mixed> $options = [] ]) : bool
Parameters
The name of the bucket
The key of the object
Additional options available in the HeadObject operation (e.g., VersionId).
Use doesObjectExistV2() instead
Determines whether or not an object exists by name.
Determines whether or not an object exists by name. This method uses S3's HeadObject operation and requires the relevant bucket and object permissions to prevent errors.
public doesObjectExistV2(string $bucket, string $key[, bool $includeDeleteMarkers = false ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
The name of the bucket
The key of the object
Set to true to consider delete markers existing objects. Using the default value of false will ignore delete markers and return false.
Additional options available in the HeadObject operation (e.g., VersionId).
if there is an unhandled exception
Downloads a bucket to the local filesystem
public downloadBucket(string $directory, string $bucket[, string $keyPrefix = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
Directory to download to
Bucket to download from
Only download objects that use this key prefix
Options available in Aws\S3\Transfer::__construct
Downloads a bucket to the local filesystem
public downloadBucketAsync(string $directory, string $bucket[, string $keyPrefix = '' ][, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
Directory to download to
Bucket to download from
Only download objects that use this key prefix
Options available in Aws\S3\Transfer::__construct
A promise that is settled when the download is complete.
execute()Execute a single command.
public execute(CommandInterface $command) : ResultInterface
Parameters
Command to execute
Execute a command asynchronously.
public executeAsync(CommandInterface $command) : PromiseInterface
Parameters
Command to execute
Get the service description associated with the client.
public getApi() : Service
Return valuesService getCommand()
Create a command for an operation name.
public getCommand(string $name[, array<string|int, mixed> $args = [] ]) : CommandInterface
Special keys may be set on the command to control how it behaves, including:
Name of the operation to use in the command
Arguments to pass to the command
if no command can be found by name
Get a client configuration value.
public getConfig([string|null $option = null ]) : mixed|null
Parameters
The option to retrieve. Pass null to retrieve all options.
Returns a promise that is fulfilled with an {@see \Aws\Credentials\CredentialsInterface} object.
public getCredentials() : PromiseInterface
If you need the credentials synchronously, then call the wait() method on the returned promise.
Return valuesPromiseInterface getEndpoint()Gets the default endpoint, or base URL, used by the client.
public getEndpoint() : UriInterface
Return valuesUriInterface getHandlerList()
Get the handler list used to transfer commands.
public getHandlerList() : HandlerList
This list can be modified to add middleware or to change the underlying handler used to send HTTP requests.
Return valuesHandlerList getIterator()Get a resource iterator for the specified operation.
public getIterator(string $name[, array<string|int, mixed> $args = [] ]) : Iterator
Parameters
Name of the iterator to retrieve.
Command arguments to use with each command.
if the iterator config is invalid.
Returns the URL to an object identified by its bucket and key.
public getObjectUrl(string $bucket, string $key) : string
The URL returned by this method is not signed nor does it ensure that the bucket and key given to the method exist. If you need a signed URL, then use the S3Client::createPresignedRequest method and get the URI of the signed request.
ParametersThe name of the bucket where the object is located
The key of the object
The URL to the object
getPaginator()Get a result paginator for the specified operation.
public getPaginator(string $name[, array<string|int, mixed> $args = [] ]) : ResultPaginator
Parameters
Name of the operation used for iterator
Command args to be used with each command
if the iterator config is invalid.
Get the region to which the client is configured to send requests.
public getRegion() : string
Return valuesstring getWaiter()
Get a waiter that waits until a resource is in a particular state.
public getWaiter(string|callable $name[, array<string|int, mixed> $args = [] ]) : Waiter
Retrieving a waiter can be useful when you wish to wait asynchronously:
$waiter = $client->getWaiter('foo', ['bar' => 'baz']); $waiter->promise()->then(function () { echo 'Done!'; });
ParametersName of the waiter that defines the wait configuration and conditions.
Args to be used with each command executed by the waiter. Waiter configuration options can be provided in an associative array in the @waiter key.
if the waiter is invalid.
Register the Amazon S3 stream wrapper with this client instance.
public registerStreamWrapper() : mixed
registerStreamWrapperV2()
Registers the Amazon S3 stream wrapper with this client instance.
public registerStreamWrapperV2() : mixed
This version uses doesObjectExistV2 and doesBucketExistV2 to check resource existence.
upload()Upload a file, stream, or string to a bucket.
public upload(string $bucket, string $key, mixed $body[, string $acl = 'private' ][, array<string|int, mixed> $options = [] ]) : ResultInterface
If the upload size exceeds the specified threshold, the upload will be performed using concurrent multipart uploads.
The options array accepts the following options:
function (Aws\Command $command) {...}
.UploadPart
operations allowed during a multipart upload.PutObject
operation. For multipart uploads, they correspond to the parameters of the CreateMultipartUpload
operation.Bucket to upload the object.
Key of the object.
Object data to upload. Can be a StreamInterface, PHP stream resource, or a string of data to upload.
ACL to apply to the object (default: private).
Options used to configure the upload process.
for more info about multipart uploads.
Returns the result of the upload.
uploadAsync()Upload a file, stream, or string to a bucket asynchronously.
public uploadAsync(string $bucket, string $key, mixed $body[, string $acl = 'private' ][, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
Bucket to upload the object.
Key of the object.
Object data to upload. Can be a StreamInterface, PHP stream resource, or a string of data to upload.
ACL to apply to the object (default: private).
Options used to configure the upload process.
Returns a promise that will be fulfilled with the result of the upload.
uploadDirectory()Recursively uploads all files in a given directory to a given bucket.
public uploadDirectory(string $directory, string $bucket[, string $keyPrefix = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
Full path to a directory to upload
Name of the bucket
Virtual directory key prefix to add to each upload
Options available in Aws\S3\Transfer::__construct
for more options and customization
Recursively uploads all files in a given directory to a given bucket.
public uploadDirectoryAsync(string $directory, string $bucket[, string $keyPrefix = null ][, array<string|int, mixed> $options = [] ]) : PromiseInterface
Parameters
Full path to a directory to upload
Name of the bucket
Virtual directory key prefix to add to each upload
Options available in Aws\S3\Transfer::__construct
for more options and customization
A promise that is settled when the upload is complete.
waitUntil()Wait until a resource is in a particular state.
public waitUntil(string|callable $name[, array<string|int, mixed> $args = [] ]) : void
Parameters
Name of the waiter that defines the wait configuration and conditions.
Args to be used with each command executed by the waiter. Waiter configuration options can be provided in an associative array in the @waiter key.
if the waiter is invalid.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4