PHP code example of nanopkg / laravel-bulk-sms-bd

1. Go to this page and download the library: Download nanopkg/laravel-bulk-sms-bd 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/ */

    

nanopkg / laravel-bulk-sms-bd example snippets


return [
     /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Mode of sending sms
    |--------------------------------------------------------------------------
    |
    | This value is the mode of your laravel-bulk-sms-bd api integration.
    | log: for testing purpose
    | live: for live sms sending
    |
    */
    'mode' => env('BULK_SMS_BD_MODE', 'log'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Key
    |--------------------------------------------------------------------------
    |
    | This value is the api key of your laravel-bulk-sms-bd api integration.
    |
    */

    'api_key' => env('BULK_SMS_BD_API_KEY', ''),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Sender ID
    |--------------------------------------------------------------------------
    |
    | This value is the Sender ID of your laravel-bulk-sms-bd api integration.
    |
    */

    'sender_id' => env('BULK_SMS_BD_SENDER_ID', ''),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Url
    |--------------------------------------------------------------------------
    |
    | This value is the Api Url of your laravel-bulk-sms-bd api integration.
    |
    */

    'base_uri' => env('BULK_SMS_BD_API_URL', 'https://bulksmsbd.net/api/'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Url SSL VERIFY
    |--------------------------------------------------------------------------
    |
    | This value is the Api Url SSL verify of your laravel-bulk-sms-bd api integration.
    |
    */

    'verify' => env('BULK_SMS_BD_API_URL_VERIFY', false),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Log
    |--------------------------------------------------------------------------
    |
    | This value is the log  of your laravel-bulk-sms-bd api integration.
    |
    */
    'log' => [
        'driver' => env('BULK_SMS_BD_LOG_DRIVER', 'single'),
        'path' => env('BULK_SMS_BD_LOG_PATH', storage_path('logs/laravel-bulk-sms-bd-log.log')),
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Notification Keys
    |--------------------------------------------------------------------------
    |
    | This value is the Notification Keys of your laravel-bulk-sms-bd api integration.
    |
    */
    'notification' => [
        // define your custom notification key for  message
        'message' => 'message',
        // define your custom notification key for mobile number
        'contacts' => 'to',
    ],
];

// This value is the mode of your laravel-bulk-sms-bd api integration. | log: for testing purpose | live: for live sms sending
BULK_SMS_BD_MODE='log'

// This value is the api key of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_API_KEY=''

// This value is the Sender ID of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_SENDER_ID=''

// This value is the Api Url SSL verify of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_API_URL_VERIFY=false

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

// get gateway balance
$response = BulkSmsBd::getBalance();
return $response->balance;

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

// send one to one sms
BulkSmsBd::oneToOne('017xxxxxxxx', 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।')->send();

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdOneToOne;

// send one to one sms
BulkSmsBdOneToOne::dispatch('017xxxxxxxx', 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।');

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

//  Send one to many sms
BulkSmsBd::oneToMany(['017xxxxxxxx','018xxxxxxxx','019xxxxxxxx'], 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।')->send();

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdOneToMany;

//  Send one to many sms
BulkSmsBdOneToMany::dispatch(['017xxxxxxxx','018xxxxxxxx','019xxxxxxxx'], 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।');

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

//  Send one to many sms
BulkSmsBd::manyToMany([
    [
        'to' => '017xxxxxxxx',
        'message' => 'আমার সোনার বাংলা।'
    ],
    [
        'to' => '018xxxxxxxx',
        'message' => 'আমি তোমার ভালোবাসি।'
    ],
])->send();

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdManyToMany;

//  Send one to many sms
BulkSmsBdManyToMany::dispatch([
     [
        'to' => '017xxxxxxxx',
        'message' => 'আমার সোনার বাংলা।'
    ],
    [
        'to' => '018xxxxxxxx',
        'message' => 'আমি তোমার ভালোবাসি।'
    ]
]);


use Nanopkg\BulkSmsBd\Broadcasting\BulkSmsBdChannel;

/**
* Get the notification's delivery channels.
*
* @param  mixed  $notifiable
* @return array
*/
public function via($notifiable)
{
    return [BulkSmsBdChannel::class];
}


/**
* Get the BulkSmsBd representation of the notification.
* @param  mixed  $notifiable
* @return array
*/
public function toBulkSmsBd($notifiable)
{
    return [
        'message' => 'আমার সোনার বাংলা, আমি তোমায় ভালোবাসি',
        'to' => $notifiable->phone,
    ];
}


'notification' => [
    // define your custom notification key for  message
    'message' => 'message',
    // define your custom notification key for mobile number
    'contacts' => 'to',
],