LanguageGuide · official SDK soon
Send SMS in Tunisia from PHP, with no dependency.
The cURL extension, available on almost every PHP server, is all you need to call the Sendimo API. No framework required, no package to install. The official PHP SDK is on its way.
What it does
- Works in plain PHP and with any framework.
- OTP codes, order confirmations, appointment reminders.
- JSON errors with a stable code (insufficient_balance, sender_not_approved…).
- 8-digit local numbers accepted and normalized to +216.
Setup
- 1Check that the cURL extension is enabled (php -m | grep curl).
- 2Put your API key in the SENDIMO_API_KEY environment variable.
- 3POST to /v1/messages and check for HTTP 202.
- 4Receive delivery statuses by webhook.
<?php
$ch = curl_init('https://api.sendimo.tn/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SENDIMO_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: order-4821-otp',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+21620123456',
'from' => 'SENDIMO',
'text' => 'Your code is 482913. It expires in 5 minutes.',
'reference' => 'order-4821',
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 202
curl_close($ch);
if ($status !== 202) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
echo $body['id']; // msg_01HF8Z3K9QX2{
"id": "msg_01HF8Z3K9QX2",
"status": "queued",
"to": "+21620123456",
"from": "SENDIMO",
"text": "Your code is 482913. It expires in 5 minutes.",
"encoding": "GSM-7",
"segments": 1,
"network": "ooredoo",
"cost": { "amount": "0.140", "currency": "TND" },
"reference": "order-4821",
"scheduled_at": null,
"created_at": "2026-10-30T09:15:00Z"
}Next steps
Other integrations
PythonLanguage
Send SMS in Tunisia from Python with the Sendimo API.
View integrationLaravelPHP framework
Send SMS in Tunisia from Laravel with the built-in HTTP client.
View integrationJavaScript / Node.jsLanguage
Send SMS in Tunisia from Node.js with fetch.
View integrationJavaLanguage
Send SMS in Tunisia from Java, with no dependency.
View integrationSpring BootJava framework
Send SMS in Tunisia from Spring Boot with RestClient.
View integrationGoLanguage
Send SMS in Tunisia from Go with net/http.
View integration