PHP code example of epmnzava / bongolivesms-laravel

1. Go to this page and download the library: Download epmnzava/bongolivesms-laravel 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/ */

    

epmnzava / bongolivesms-laravel example snippets


php artisan vendor:publish --provider="Epmnzava\BongolivesmsLaravel\BongolivesmsLaravelServiceProvider"
 php

Sending to one msisdn at a time 


use Bongolive;

class DashboardController extends Controller
{
    //


    public function runSms(){

//assuming $recipient_msisdn is your receipient number 
//we need to change it from 0XXXX to 255XXX

if(substr($recipient_msisdn, 0, 1)==0){
  $msisdn = ltrim($recipient_msisdn, "0");

  $recipient_msisdn="255"."".$msisdn;


}else{}
        $response=Bongolive::send__single_recipient($source_addr,$message,$recipient_msisdn);

    }


Sending multiple msisdn at one by passing an array of numbers


use Bongolive;

class DashboardController extends Controller
{
    //


    public function runSms(){

//assuming $recipient_msisdn is your receipient number 
//we need to change it from 0XXXX to 255XXX

 
 $recipient_array=["255679079774","2556789909"];
        $response=Bongolive::send__multiple_recipient($source_addr,$message,$recipient_array);

    }