SDK for PHP 3.x

SignatureV4
in package
implements SignatureInterface Uses SignatureTrait

Signature Version 4

Tags
link
http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

Table of Contents

Interfaces

SignatureInterface
Interface used to provide interchangeable strategies for signing requests using the various AWS signature protocols.

Constants

AMZ_CONTENT_SHA256_HEADER  = 'X-Amz-Content-Sha256'
ISO8601_BASIC  = 'Ymd\\THis\\Z'
UNSIGNED_PAYLOAD  = 'UNSIGNED-PAYLOAD'

Methods

__construct()  : mixed
convertPostToGet()  : RequestInterface
Converts a POST request to a GET request by moving POST fields into the query string.
presign()  : RequestInterface
Create a pre-signed request.
signRequest()  : RequestInterface
Signs the specified request with an AWS signing protocol by using the provided AWS account credentials and adding the required headers to the request.

Constants

AMZ_CONTENT_SHA256_HEADER

public mixed AMZ_CONTENT_SHA256_HEADER = 'X-Amz-Content-Sha256'

ISO8601_BASIC

public mixed ISO8601_BASIC = 'Ymd\\THis\\Z'

UNSIGNED_PAYLOAD

public mixed UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'

Methods

__construct()

public __construct(string $service, string $region[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$service : string

Service name to use when signing

$region : string

Region name to use when signing

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

Array of configuration options used when signing

  • unsigned-body: Flag to make request have unsigned payload. Unsigned body is used primarily for streaming requests.

convertPostToGet()

Converts a POST request to a GET request by moving POST fields into the query string.

public static convertPostToGet(RequestInterface $request[, mixed $additionalQueryParams = "" ]) : RequestInterface

Useful for pre-signing query protocol requests.

Parameters
$request : RequestInterface

Request to clone

$additionalQueryParams : mixed = ""
Tags
throws
InvalidArgumentException

if the method is not POST

Return values
RequestInterface

presign()

Create a pre-signed request.

public presign(RequestInterface $request, CredentialsInterface $credentials, mixed $expires[, array<string|int, mixed> $options = [] ]) : RequestInterface
Parameters
$request : RequestInterface

Request to sign

$credentials : CredentialsInterface

Credentials used to sign

$expires : mixed

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.

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

signRequest()

Signs the specified request with an AWS signing protocol by using the provided AWS account credentials and adding the required headers to the request.

public signRequest(RequestInterface $request, CredentialsInterface $credentials[, mixed $signingService = null ]) : RequestInterface
Parameters
$request : RequestInterface

Request to sign

$credentials : CredentialsInterface

Signing credentials

$signingService : mixed = null
Return values
RequestInterface

Returns the modified request.

On this page