Build your SMS application with PHP, easy SMS sending and worldwide coverage
SMS Library for sending text messages to mobile numbers worldwide from your own application via Descom SMS gateway.
Create your free account at Descom SMS and buy credits for SMS sending when required.
You can install it with composer:
composer require descom/sms-php
This is an example:
$sms = new Sms(new AuthUser('your_username', 'your_password')); $message = new Message(); $message->addTo('mobile_number')->setText('message_text'); $result = $sms->addMessage($message) ->setDryrun(true) ->send();
You can send multiple SMS in one go, function
//... $message->addTo('mobile_number_1') ->addTo('mobile_number_2'); //...
or with an Array:
//... $message->addTo([ 'mobile_number_1', 'mobile_number_2' ]); //...
getBalance allows you to check your SMS balance, this is your credit available. Example:
$sms = new Sms(new AuthUser('replace_by_your_usernme', 'replace_by_your_password')); $balance = $sms->getBalance(); echo 'Your balance is '.$balance."\n";
getSenderID allows you get the list of senderID authorized. Example:
$sms = new Sms(new AuthUser('replace_by_your_usernme', 'replace_by_your_password')); $senderID = $sms->getSenderID(); echo 'Your balance is '.PHP_EOL; print_r($senderID);
Alphanumeric sender ID allows you to set your name or business brand as the sender ID. Use the function
Note your sender ID should previously be added in your Descom SMS account setup.
Test your SMS sending application at no cost by using function
setDryrun in the class
Descom\Sms\Sms and set to
Dryrun just simulates SMS sending; no message will be sent out and no SMS credit will be deducted from your account.
Examples available at folder Examples.