Install
didit-protocol/sdk-php on Packagist. Its source and changelog are in didit-protocol/sdk-php on GitHub.
Token verification for Authentication also needs the openssl extension.
Configure the client
new DiditClient() reads DIDIT_API_KEY from the environment. Pass named arguments to override it, or to set the organization and application ids that application-scoped calls (cases, networks, regulatory reports) need. Request fields are one array with the API’s own field names; responses are read-only objects with camelCase properties and toArray().
Create a session
Create a verification session for a workflow and send your user to its URL.Read the decision
When the user finishes (or when the webhook arrives), read the decision. Every feature result is a list with one entry per workflow node.Verify a webhook
Pass the raw body, exactly as received, and the request headers.verify throws WebhookVerificationException for anything that is not a valid, fresh delivery, and returns a typed event otherwise.
$request->getContent() and $request->headers->all(); with a PSR-7 request, pass the request itself as the headers. While you rotate the secret, pass both: [$newSecret, $oldSecret]. See Webhooks for the events and the signature scheme.
Screen a transaction
Submit a payment, withdrawal or crypto transfer to transaction monitoring; the response carries its status and risk score.Verify Authentication tokens
Authentication checks the access tokens your Authentication issuer signs, in your backend, without calling Didit for each request. Pass a PSR-16 cache so the issuer’s keys are fetched once, not on every request. It also exchanges codes, refreshes tokens, checks and revokes sessions, and runs step-ups.
Token verification makes the checks in Verify a token on your server, against your application’s issuer and signing keys.