PHP code example of descom / sms-php

1. Go to this page and download the library: Download descom/sms-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

descom / sms-php example snippets


$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();

//...

$message->addTo('mobile_number_1')
        ->addTo('mobile_number_2');

//...

//...

$message->addTo([
    'mobile_number_1',
    'mobile_number_2'
]);
//...

$sms = new Sms(new AuthUser('replace_by_your_usernme', 'replace_by_your_password'));

$balance = $sms->getBalance();

echo 'Your balance is '.$balance."\n";

$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);

$message->setSenderID('replace_by_sender_of_message');

$sms->setDryrun(true);
bash
composer