proofage/php-sdk is the framework-neutral PHP client: request signing, every endpoint, streaming media downloads and webhook verification. Its only runtime dependencies are PHP 8.1+, ext-curl, ext-json and the psr/http-message interfaces.
On Laravel, use the Laravel SDK, which wraps this one.
Install
Configure
Create a verification
Read results
downloadMediaTo() streams an image to a file and only writes it after a 2xx.
Receive webhooks
MISSING_SIGNATURE, MISSING_TIMESTAMP, MISSING_AUTH_CLIENT, INVALID_AUTH_CLIENT, TIMESTAMP_TOO_OLD or INVALID_SIGNATURE.
Everything else
erasePersonalData() erases the verification’s personal data and returns it with its erasure field set; see Data retention and erasure. ErasureReasonCode lists the reason codes.
Errors and retries
Every attempt is signed with a new
X-Timestamp. verifications()->create() and webhookSubscriptions()->create() send an Idempotency-Key (a new UUID per call, or yours as the second argument) and keep it across their retries.
A GET, and the two creates because of their key, are retried after a transport failure, a 429 or a 5xx; a create is also retried on 409 IDEMPOTENCY_KEY_IN_PROGRESS after Retry-After. Other POSTs are retried only when the connection failed before sending, or on a 429 with Retry-After; a 5xx or a timeout is thrown at once, because the server may already have acted. A request other than a GET answered REPLAYED_REQUEST is signed again and sent once more. These rules are from version 0.15.0; earlier versions sign without a timestamp and do not retry a create on a 5xx. erasePersonalData() follows the POST rule: a 409 or 503 with Retry-After is thrown, and calling it again is safe.
Dumping a client or an exception with print_r() or var_dump() never shows the secret key.