Class S3Client
- Aws\AwsClient implements Aws\AwsClientInterface uses Aws\AwsClientTrait
-
Aws\S3\S3Client implements Aws\S3\S3ClientInterface uses Aws\S3\S3ClientTrait
- Namespace: Aws\S3
- Located at S3/S3Client.php
Client used to interact with Amazon Simple Storage Service (Amazon S3).
Supported API Versions
This class uses a service description model that is associated at
runtime based on the version
option given when constructing the
client. The version
option will determine which API operations,
waiters, and paginators are available for a client. Creating a command or a
specific API operation can be done using magic methods (e.g.,
$client->commandName(/** parameters */)
, or using the
$\client->getCommand
method of the client.
Methods Summary
-
static
getArguments ( )
Get an array of client constructor arguments used by the client.
-
__construct ( array $args )
The client constructor accepts the following options:
-
static
isBucketDnsCompatible ( string $bucket )
Determine if a string is a valid name for a DNS compatible Amazon S3 bucket.
- static _apply_use_arn_region ( $value, array & $args, Aws\HandlerList $list )
-
createPresignedRequest ( Aws\CommandInterface $command, int|string|\DateTimeInterface $expires, array $options = [] )
Create a pre-signed URL for the given S3 command object.
-
getObjectUrl ( string $bucket, string $key )
Returns the URL to an object identified by its bucket and key.
-
static
encodeKey ( string $key )
Raw URL encode a key and allow for '/' characters
Methods inherited from Aws\AwsClient
__sleep()
,
applyDocFilters()
,
emitDeprecationWarning()
,
factory()
,
getApi()
,
getClientBuiltIns()
,
getClientContextParams()
,
getCommand()
,
getConfig()
,
getCredentials()
,
getEndpoint()
,
getEndpointProvider()
,
getEndpointProviderArgs()
,
getHandlerList()
,
getRegion()
,
getSignatureProvider()
Methods inherited from Aws\AwsClientInterface
Methods inherited from Aws\S3\S3ClientInterface
copy()
,
copyAsync()
,
deleteMatchingObjects()
,
deleteMatchingObjectsAsync()
,
determineBucketRegion()
,
determineBucketRegionAsync()
,
doesBucketExist()
,
doesBucketExistV2()
,
doesObjectExist()
,
doesObjectExistV2()
,
downloadBucket()
,
downloadBucketAsync()
,
registerStreamWrapper()
,
registerStreamWrapperV2()
,
upload()
,
uploadAsync()
,
uploadDirectory()
,
uploadDirectoryAsync()
Methods used from Aws\S3\S3ClientTrait
copy()
,
copyAsync()
,
deleteMatchingObjects()
,
deleteMatchingObjectsAsync()
,
determineBucketRegion()
,
determineBucketRegionAsync()
,
doesBucketExist()
,
doesBucketExistV2()
,
doesObjectExist()
,
doesObjectExistV2()
,
downloadBucket()
,
downloadBucketAsync()
,
execute()
,
getCommand()
,
getHandlerList()
,
getIterator()
,
registerStreamWrapper()
,
registerStreamWrapperV2()
,
upload()
,
uploadAsync()
,
uploadDirectory()
,
uploadDirectoryAsync()
Methods used from Aws\AwsClientTrait
Methods Details
static array getArguments ( )
Get an array of client constructor arguments used by the client.
Returns
array |
Overrides
__construct ( array $args )
The client constructor accepts the following options:
In addition to the options available to Aws\AwsClient::__construct, S3Client accepts the following options:
- bucket_endpoint: (bool) Set to true to send requests to a hardcoded bucket endpoint rather than create an endpoint as a result of injecting the bucket into the URL. This option is useful for interacting with CNAME endpoints. Note: if you are using version 2.243.0 and above and do not expect the bucket name to appear in the host, you will also need to set
use_path_style_endpoint
totrue
. - calculate_md5: (bool) Set to false to disable calculating an MD5 for all Amazon S3 signed uploads.
- s3_us_east_1_regional_endpoint: (Aws\S3\RegionalEndpoint\ConfigurationInterface|Aws\CacheInterface|callable|string|array) Specifies whether to use regional or legacy endpoints for the us-east-1 region. Provide an Aws\S3\RegionalEndpoint\ConfigurationInterface object, an instance of Aws\CacheInterface, a callable configuration provider used to create endpoint configuration, a string value of
legacy
orregional
, or an associative array with the following keys: endpoint_types: (string) Set tolegacy
orregional
, defaults tolegacy
- use_accelerate_endpoint: (bool) Set to true to send requests to an S3 Accelerate endpoint by default. Can be enabled or disabled on individual operations by setting '@use_accelerate_endpoint' to true or false. Note: you must enable S3 Accelerate on a bucket before it can be accessed via an Accelerate endpoint.
- use_arn_region: (Aws\S3\UseArnRegion\ConfigurationInterface, Aws\CacheInterface, bool, callable) Set to true to enable the client to use the region from a supplied ARN argument instead of the client's region. Provide an instance of Aws\S3\UseArnRegion\ConfigurationInterface, an instance of Aws\CacheInterface, a callable that provides a promise for a Configuration object, or a boolean value. Defaults to false (i.e. the SDK will not follow the ARN region if it conflicts with the client region and instead throw an error).
- use_dual_stack_endpoint: (bool) Set to true to send requests to an S3 Dual Stack endpoint by default, which enables IPv6 Protocol. Can be enabled or disabled on individual operations by setting '@use_dual_stack_endpoint\' to true or false. Note: you cannot use it together with an accelerate endpoint.
- use_path_style_endpoint: (bool) Set to true to send requests to an S3 path style endpoint by default. Can be enabled or disabled on individual operations by setting '@use_path_style_endpoint\' to true or false. Note: you cannot use it together with an accelerate endpoint.
- disable_multiregion_access_points: (bool) Set to true to disable sending multi region requests. They are enabled by default. Can be enabled or disabled on individual operations by setting '@disable_multiregion_access_points\' to true or false. Note: you cannot use it together with an accelerate or dualstack endpoint.
Parameters
array | $args |
Exceptions
InvalidArgumentException if any required options are missing or the service is not supported. |
Overrides
static boolean isBucketDnsCompatible ( string $bucket )
Determine if a string is a valid name for a DNS compatible Amazon S3 bucket.
DNS compatible bucket names can be used as a subdomain in a URL (e.g.,
"
Parameters
string | $bucket | Bucket name to check. |
Returns
boolean |
static
_apply_use_arn_region (
$value,
array
& $args,
Aws\HandlerList
$list
)
Psr\Http\Message\RequestInterface
createPresignedRequest (
Aws\CommandInterface
$command,
integer|string|DateTimeInterface
$expires,
array
$options = []
)
Create a pre-signed URL for the given S3 command object.
Parameters
Aws\CommandInterface |
$command | Command to create a pre-signed URL for. |
integer|string|DateTimeInterface | $expires | 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(). |
array | $options = [] |
Returns
Psr\Http\Message\RequestInterface |
Implementation of
string getObjectUrl ( string $bucket, string $key )
Returns the URL to an object identified by its bucket and key.
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 \Aws\S3\S3Client::createPresignedRequest method and get the URI of the signed request.
Parameters
string | $bucket | The name of the bucket where the object is located |
string | $key | The key of the object |
Returns
string The URL to the object |
Implementation of
static string encodeKey ( string $key )
Raw URL encode a key and allow for '/' characters
Parameters
string | $key | Key to encode |
Returns
string Returns the encoded key |