SDK Documentation
Choose your language and integrate SMS sending in minutes.
Installation
terminal
composer require maiyun/sms
Send SMS
PHPsend.php
<?php
require 'vendor/autoload.php';
use Maiyun\Sms\Client;
$client = new Client('YOUR_API_KEY');
// --- send ---
$result = $client->send([
'phone' => '8613800138000',
'text' => 'Your verification code is 123456, valid for 5 minutes.',
]);
if ($result['result'] === 1) {
echo 'uid: ' . $result['uid'];
} else {
echo 'error: ' . $result['error'];
}Important Notes
1Phone numbers must include country code, e.g. 8613800138000 (86 = China Mainland).
2Keep your API Key secret. Never expose it in client-side code; use environment variables.
3Messages over 160 chars (70 for Chinese) are auto-split into multiple segments.
4Save the returned uid to track delivery status in the console.