PHP code example of vmosoti / bongatech-sms

1. Go to this page and download the library: Download vmosoti/bongatech-sms 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/ */

    

vmosoti / bongatech-sms example snippets


sms()  // you have the SMS object

$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'your source id here'
        ),
        array(
            'MSISDN' => '0775345678',
            'LinkID' => '',
            'SourceID' => 'source id for this here'
        )
    );

$messages = array(
        array(
            'Text' => 'Message 1 goes here'
        ),
        array(
            'Text' => 'Message 2 goes here'
        )
    );

$message = array(
        array(
            'Text' => 'This message is for a single recipient'
        )
    );
    
$recipient = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'your source id here'
        )
    );
    
$response = $sms->bulk()->toOne()->send($recipient, $message);

$response = sms()->bulk()->toOne()->send($recipient, $message);

$message = array(
        array(
            'Text' => 'This message goes to many recipients'
        )
    );
    
$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 1'
        ),
        array(
            'MSISDN' => '0713678900',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 2'
            ),
    );
    
$responses = $sms->bulk()->toMany()->send($recipients, $message);

$messages = array(
        array(
            'Text' => 'This is message for recipient 1'
        ),
        array(
             'Text' => 'This is message for recipient 2'
        )
    );
    
$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 1'
        ),
        array(
            'MSISDN' => '0713678900',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 2'
            ),
    );
    
$responses = $sms->bulk()->toMany()->send($recipients, $messages);

foreach($responses as $response){
$response->getCode();
------
}

$response = SMS::getBalance();

get_balance();

$response->getBalance()

$response = \VMosoti\BongaTech\DeliveryReport::get();
 php
$sms = new  \VMosoti\BongaTech\SMS();


$response->getReport();
$response->getMessageID();
$response->getCorrelator();
$response->getSourceID();