Search by

kinetis / aws-sigv4

aln-1

A PSR-18 client that signs outgoing requests with AWS Signature Version 4 (SigV4) for one configured origin — checked against AWS's published SigV4 test vectors, non-blocking via kinetis/revolt-http-client. Usable standalone, not only with Kinetis.

Package info

github.com/kinetis-dev/aws-sigv4

pkg:composer/kinetis/aws-sigv4

Statistics

Installs: 13

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.3.2 2026-09-13 11:01 UTC

This package is auto-updated.

Last update: 2026-09-13 11:15:51 UTC


README

Kinetis

kinetis/aws-sigv4
A PSR-18 client that signs requests with AWS Signature Version 4

Packagist Version Packagist Downloads PHP Version License CI

Part of Kinetis, a non-blocking PHP framework for API-first applications, developed in the kinetis-dev/kinetis monorepo.

A PSR-18 HTTP client that signs every outgoing request with AWS Signature Version 4 (SigV4) and sends it to one configured origin, checked against AWS's own published SigV4 test vectors. Usable outside Kinetis entirely, the same relationship kinetis/revolt-http-client already has with the wider PHP ecosystem.

use Kinetis\AwsSigV4\SigV4SigningClient;

$signedClient = new SigV4SigningClient(
    origin: 'https://search-my-domain.us-east-1.es.amazonaws.com',
    region: 'us-east-1',
    service: 'es', // Amazon OpenSearch Service's signing name
);

$response = $signedClient->sendRequest($request);

$origin is the only scheme, host, and port this client will sign for, with an optional path prefix that binds every request. A relative request resolves against it; anything else — another host, another port, an http target under an https origin, a path that leaves the prefix — is rejected before credentials are resolved, before the body is read, and before the network is touched. The target is put into the exact form it will be sent in before both the check and the signature, so the signature covers the bytes that go out. A 3xx response is returned as it is: nothing is re-signed and no Location is followed, for the signed request or for the credential lookups. Signing reads the request body once, from where it stands, and consumes it. A request is bounded at 30 seconds idle and 30 seconds end to end, each settable on its own through SignedTransport::create().

$service is the AWS signing service name ("es" for Amazon OpenSearch Service, "execute-api" for API Gateway, and so on) — required, with no default, since guessing wrong produces a signature that fails verification rather than an obvious error.

Credentials

Resolved through AsyncAws's five providers in their standard order (environment variables, including the STS assume-role AWS_ROLE_ARN selects; web identity; the shared credentials and config files; ECS or EKS pod identity; IMDS) unless a CredentialProvider is passed as the fourth constructor argument. Every provider in it that calls AWS uses the same SignedTransport the signed request travels on; the shared credentials and config files and any token file are read with native blocking calls. The first unexpired credentials are held until they expire, and a lookup that resolves nothing holds nothing.

Installation

composer require kinetis/aws-sigv4

Requires PHP 8.4+ and kinetis/revolt-http-client. Full documentation, including the origin grammar, deadlines, failure behavior, and what is buffered or blocking: kinetis.dev/docs/aws-sigv4.html.

License

MIT — see LICENSE.