PHP client library for the e-post SMS API.
- PHP >= 7.0
- cURL extension
composer require hostlink/epost-phprequire'vendor/autoload.php';
$key = 'your_jwt_token'; // Bearer token from e-post$epost = newEPost($key);useEPost\SMS;
$sms = newSMS();
$sms->setPhone('93465221'); // 8-digit HK number (852 added automatically)$sms->setContent('Hello');
// Optional: set a different country code (default: 852)// $sms->setCountryCode('86'); // e.g. mainland China$smsId = $epost->sendSMS($sms);
echo"Sent! sms_id: $smsId";sendSMS() returns the sms_id (int) on success, or throws an Exception on error.
$from = '2026-05-01';
$to = '2026-05-28';
$report = $epost->getSMSReport($from, $to);
foreach ($reportas$row) {
echo$row['sms_id'] . ' | '
. $row['phone'] . ' | '
. $row['content'] . ' | '
. $row['created_time'] . PHP_EOL;
}Each record contains: sms_id, phone, content, created_time, no_of_msg, receive_status, receive_time.
echo$epost->getSMSQuota(); // int e.g. 1200echo$epost->getSMSExpiryDate(); // string e.g. "2394-08-26"