PHP code example of pnlinh / laravel-infobip-sms

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

    

pnlinh / laravel-infobip-sms example snippets


return [
    'from' => env('INFOBIP_FROM', 'Laravel'),
    'username' => env('INFOBIP_USERNAME', 'user'),
    'password' => env('INFOBIP_PASSWORD', '123456'),
];

// Send to one number
use Pnlinh\InfobipSms\Facades\InfobipSms;

$response = InfobipSms::send('84123456789', 'Hello Infobip');

// Send to multiple number
$response = InfobipSms::send(['84123456789', '84987654321'], 'Hello Infobip');

// Use Helper Function
$response = infobip_sms_send('84123456789', 'Hello Infobip');

// Get response
array:2 [
0 => 200
1 => {#362
 +"messages": array:1 [
   0 => {#355
     +"to": "84123456789"
     +"status": {#356
       +"groupId": 1
       +"groupName": "PENDING"
       +"id": 8
       +"name": "PENDING_ENROUTE"
       +"description": "Message sent to next instance"
     }
     +"smsCount": 1
     +"messageId": "2411455387981631234"
   }
 ]
}
]

$responseCode = $response[0];
$responseBody = $response[1];
bash
php artisan vendor:publish --tag="infobip-sms"