Search by

verixo / sdk

titicodes

Official PHP SDK for the VerifiedCore API: phone verification (Verify), eSIM, call plans, wallet

v0.5.0 2026-09-24 23:52 UTC

This package is auto-updated.

Last update: 2026-10-14 13:10:39 UTC


README

Official PHP SDK for the VerifiedCore API.

Install

composer require verixo/sdk

Verify: send one-time codes to your own users

Send a code to your user's phone at sign-up, login or 2FA, then check what they typed. VerifiedCore generates, delivers, rate-limits and expires the code.

use Verixo\Client;
use Verixo\Exception\VerixoException;

$vc = new Client(getenv('VC_API_KEY'));

// 1. Send a code
$v = $vc->verify->start('+2348031234567', ip: $_SERVER['REMOTE_ADDR']);

// 2. Check the code your user typed
$r = $vc->verify->check($userInput, id: $v->id);
if ($r->valid) {
    // signed in
} else {
    echo "{$r->attemptsRemaining} attempts left\n";
}

With a vc_test_ key nothing is sent or charged, and the code is always 123456, so you can build your flow end-to-end before going live.

Other calls: $vc->verify->get($id), $vc->verify->list(page:, size:), $vc->verify->settings() and $vc->verify->updateSettings(brandName:, allowedCountries:, codeLength:, ttlSeconds:).

Failures throw a VerixoException whose errorCode says why, e.g. COUNTRY_NOT_ALLOWED, INVALID_NUMBER, RESEND_TOO_SOON or RATE_LIMITED.

Numbers

use Verixo\Client;

$vc = new Client(getenv('VC_API_KEY'));

$result = $vc->numbers->search([
    'serviceSlug' => 'whatsapp',
    'countryCode' => 'NG',
    'minScore'    => 80,
    'limit'       => 5,
]);

$session = $vc->numbers->purchase([
    'serviceSlug' => 'whatsapp',
    'countryCode' => 'NG',
]);

$vc->subscribe($session->sessionToken, function ($push) {
    echo "OTP: {$push->otp} in {$push->latencyMs}ms\n";
});

Note: purchase() takes serviceSlug + countryCode, not a specific numberId -- the server picks the best available number by Health Score at purchase time, since a candidate returned by search() could already be gone by the time you'd reference it back.

subscribe() is synchronous, unlike the Node/Python SDKs

PHP scripts typically run to completion rather than holding an event loop open, so subscribe() blocks the calling script until the OTP arrives or $timeoutSeconds elapses (default 90s) -- it doesn't return an unsubscribe handle. It returns the OtpPush (also passed to your callback), or null on timeout.

Polling instead of real-time push

$result = $vc->sessions->waitForOtp($session->sessionToken, timeoutSeconds: 90);
if ($result->status === 'DELIVERED') {
    echo $result->otpCode;
}

Errors

All non-2xx responses throw Verixo\Exception\VerixoException with ->status, and usually ->errorCode/->detail from the API's error body:

use Verixo\Exception\VerixoException;

try {
    $vc->numbers->purchase(['serviceSlug' => 'whatsapp', 'countryCode' => 'NG']);
} catch (VerixoException $e) {
    if ($e->status === 402) {
        echo "Insufficient wallet balance\n";
    }
}

Requirements

PHP 8.1+, with the curl and json extensions (both enabled by default in most PHP installs).

Development

composer install
composer exec phpstan analyse   # static analysis, level 8
php examples/quickstart.php     # requires VC_API_KEY env var, see file header