PHP code example of vouchsafe / vouchsafe-php

1. Go to this page and download the library: Download vouchsafe/vouchsafe-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vouchsafe / vouchsafe-php example snippets



Vouchsafe\VouchsafeClient;

$client = new VouchsafeClient([
  'client_id' => 'YOUR_CLIENT_ID',
  'client_secret' => 'YOUR_SANDBOX_SECRET',
]);

// Request a verification
$res = $client->requestVerification([
  'email' => '[email protected]'
]);

echo $res->getId();
echo $res->getUrl();

$list = $client->listVerifications(['status' => 'InProgress']);

$verification = $client->getVerification(['id' => 'abc123']);

$flows = $client->listFlows();

try {
  $res = $client->getVerification(['id' => 'non-existent']);
} catch (\Vouchsafe\VouchsafeApiError $e) {
  echo $e->statusCode . ' ' . $e->getMessage();
}

composer