Zindua for PHP
Laravel, Symfony, WordPress custom, cron scripts. Send OTP email and WhatsApp with zindua/sdk — same API as Node.
Server-side only
ZINDUA_API_KEY in .env or getenv(). Never expose in the browser or mobile app.
Typed validation
Email, E.164 WhatsApp, template slugs validated locally before calling the API.
Email + WhatsApp
One send() method for both channels. Same templates as Node and WordPress.
Zero HTTP deps
Uses PHP ext-curl and ext-json only. No Guzzle required.
Laravel ready
Register Client as a singleton. Inject in controllers, jobs, and notifications.
CLI companion
Test sends with @zindua/cli before wiring PHP code.
Install and send
Three steps from composer require to your first OTP.
composer require zindua/sdk
# .env
ZINDUA_API_KEY=znd_test_your_key_hereEmail OTP
<?php
use Zindua\Client;
$zindua = new Client(['apiKey' => getenv('ZINDUA_API_KEY')]);
$result = $zindua->send([
'to' => 'user@example.com',
'template' => 'otp-verification',
'lang' => 'fr',
'variables' => ['code' => '482910', 'appName' => 'MyShop'],
]);
echo $result['logId'];WhatsApp OTP
$zindua->send([
'to' => '+243812345678',
'channel' => 'whatsapp',
'template' => 'otp-verification',
'variables' => ['code' => '482910'],
]);Step by step
Create a Zindua project
Sign up at zindua.run, create a project, copy the API key. Connect email and/or WhatsApp in the dashboard.
Install the SDK
composer require zindua/sdk in your Laravel, Symfony, or WordPress custom project.
Send from PHP
new Client(['apiKey' => getenv('ZINDUA_API_KEY')]) then send() with template slug and variables.
Test with CLI
npx @zindua/cli@latest doctor and send — smoke test before deploying PHP code.
Methods
Parity with @zindua/sdk TypeScript.
| Method | Endpoint | Description |
|---|---|---|
| send() | POST /send | Queue email or WhatsApp message |
| getProject() | GET /project | Project, plan, channel status |
| getTemplates() | GET /templates | Synced slugs, langs, variables |
| connect() | POST /connect | Bind API key to site URL |
Laravel and WordPress
// config/zindua.php
return ['api_key' => env('ZINDUA_API_KEY')];
// AppServiceProvider
$this->app->singleton(Client::class, fn () => new Client([
'apiKey' => config('zindua.api_key'),
]));// mu-plugins/zindua-otp.php
require_once ABSPATH . 'vendor/autoload.php';
$zindua = new \Zindua\Client([
'apiKey' => getenv('ZINDUA_API_KEY'),
]);Variables
| Variable | Required | Example | Notes |
|---|---|---|---|
| ZINDUA_API_KEY | Yes | znd_test_xxxxxxxxxxxxxxxxxxxxxxxx | From Dashboard → Projects |
| ZINDUA_API_BASE_URL | No | https://zindua.run/api/v1 | Optional API override |
| ZINDUA_SITE_URL | No | https://myshop.com | For bound keys (WordPress connect) |
Test first with the CLI
Smoke test your API key before writing PHP code.
npx @zindua/cli@latest doctorWordPress without code?
Use the official zindua-connect plugin for OTP login and contact forms.