vouchsafe / vouchsafe-php
Official PHP library for the Vouchsafe identity platform. Use it for easy KYC checks, identity verification, remote right-to-work and more.
Requires
- php: >=7.2.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.10
- guzzlehttp/psr7: ^1.7 || ^2.0
- jane-php/open-api-runtime: ^7.10
- nyholm/psr7: ^1.8
- php-http/client-common: ^2.7
- php-http/discovery: ^1.20
- php-http/guzzle7-adapter: ^1.1
- psr/simple-cache: ^1 || ^2 || ^3
- symfony/property-access: ^8.0
- symfony/serializer: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- jane-php/open-api-3: ^7.10
- phpunit/phpunit: ^8.0 || ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.1.79
- v0.1.78
- v0.1.77
- v0.1.76
- v0.1.75
- v0.1.74
- v0.1.73
- v0.1.72
- v0.1.71
- v0.1.70
- v0.1.69
- v0.1.68
- v0.1.67
- v0.1.66
- v0.1.65
- v0.1.64
- v0.1.63
- v0.1.62
- v0.1.61
- v0.1.60
- v0.1.59
- v0.1.58
- v0.1.57
- v0.1.56
- v0.1.55
- v0.1.54
- v0.1.53
- v0.1.52
- v0.1.51
- v0.1.50
- v0.1.49
- v0.1.48
- v0.1.47
- v0.1.46
- v0.1.45
- v0.1.44
- v0.1.43
- v0.1.42
- v0.1.41
- v0.1.40
- v0.1.39
- v0.1.38
- v0.1.37
- v0.1.36
- v0.1.35
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
This package is auto-updated.
Last update: 2026-09-24 14:00:32 UTC
README
The Vouchsafe PHP library provides convenient, typed access to the Vouchsafe API for applications written in PHP.
Requirements
PHP 7.2.5 or better.
Installation
composer require vouchsafe/vouchsafe-php
Usage
The SDK needs a client ID and secret, which is available in the Vouchsafe dashboard. Replace the values below:
<?php require __DIR__ . '/vendor/autoload.php'; use Vouchsafe\VouchsafeClient; $client = new VouchsafeClient([ 'client_id' => 'YOUR_CLIENT_ID', 'client_secret' => 'YOUR_SANDBOX_SECRET', ]); // Request a verification $res = $client->requestVerification([ 'email' => 'foo@bar.com' ]); echo $res->getId(); echo $res->getUrl();
List verifications
$list = $client->listVerifications(['status' => 'InProgress']);
Get a specific verification
$verification = $client->getVerification(['id' => 'abc123']);
List flows
$flows = $client->listFlows();
Verify a photo ID
Extract and validate a photo ID (passport, national ID, driving licence, PASS card, or unfamiliar photo ID), optionally face-matching it against a selfie. Image fields are passed as file paths:
$result = $client->verifyPhotoId([ 'sub_type' => 'DrivingLicence', // Passport | NationalId | DrivingLicence | PASSCard | UnfamiliarPhotoId 'front' => '/path/to/licence-front.jpg', 'country_code' => 'GB', // DrivingLicence only // 'back' => '/path/to/back.jpg', // NationalId only // 'face_scan' => '/path/to/selfie.jpg', // Optional selfie to face-match ]); echo $result['outcome']; // 'pass' or 'fail' echo $result['extracted_details']['first_name'];
Sandbox mode
Use a sandbox rather than a live client secret to activate sandbox mode on methods that support it.
Re-authentication
The client will automatically cache your access token and insert it into every request, and fetch a new one upon expiry.
If a request fails with a 401 Unauthorised error, it will fetch a new access token and retry once before throwing an error.
Use one client instance
For best performance, you should create one client per request/process.
The client caches the access token in memory for the life of that process.
If you run multiple instances of your app, each instance can authenticate on its own and cache its own access token.
Handling errors
Wrapper methods throw Vouchsafe\VouchsafeApiError on non-2xx responses.
It includes the HTTP status code and the error body:
try { $res = $client->getVerification(['id' => 'non-existent']); } catch (\Vouchsafe\VouchsafeApiError $e) { echo $e->statusCode . ' ' . $e->getMessage(); }
Development
See the contribution guidelines for this project
Contributions including issues and pull requests are welcome.
To run the project locally, clone the repo and run:
composer install
make generate # regenerate the OpenAPI files from spec