Skip to content

SDK

Cascade OTP in PHP

Connect Cascade via cURL / Laravel Http: send and verify OTP.

Cascade provides a REST API. Below is a practical minimum in PHP with the cURL / Laravel Http client.

Useful links: API, send, verify, examples, FAQ, pricing, documentation.

Installation

An official Composer package may not exist. In Laravel use the Http facade; in plain PHP — cURL.

# Laravel already includes an HTTP client

Laravel client (fragment)

Http::withToken($token)
    ->acceptJson()
    ->post('https://cascade.kz/api/otp/send', [
        'phone' => '77001234567',
        'purpose' => 'verification',
    ])->json();

cURL

$ch = curl_init('https://cascade.kz/api/otp/verify');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer '.$token,
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'phone' => '77001234567',
        'code' => '482910',
        'purpose' => 'verification',
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);
$body = json_decode(curl_exec($ch), true);

See documentation, send-otp, FAQ.