1. Go to this page and download the library: Download smileid/usesmileid 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/ */
smileid / usesmileid example snippets
use SmileIdentity\Client;
$smile = new Client(
partnerId: '1234',
apiKey: getenv('SMILE_API_KEY'),
environment: 'sandbox', // default
defaultCallbackUrl: 'https://app.example.com/cb', // optional
);
$status = $smile->verifications->retrieve($accepted->jobId);
$status->status; // "processing", "not_found", or the decision: "clear", "block", "attention", "error"
$status->isComplete; // true when terminal, i.e. neither processing nor not_found
$status->message; // e.g. "Job completed"
$status = $smile->verifications->waitUntilComplete(
$accepted->jobId,
interval: 2.0, // seconds between polls
timeout: 60.0, // seconds before TimeoutError
treatNotFoundAsPending: true,
);
use SmileIdentity\Errors\PaymentRequiredError;
use SmileIdentity\Errors\SmileIDError;
try {
$smile->enhancedKyc->verify(/* ... */);
} catch (PaymentRequiredError $e) {
// top up the wallet
} catch (SmileIDError $e) {
$e->getMessage(); // human-readable message
$e->statusCode; // HTTP status, null for local/connection errors
$e->status; // status text from the body, when present
$e->code; // API error code, e.g. "2413" (services endpoints only)
$e->rawBody; // the unparsed response body
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.