PHP code example of softon / sms

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

    

softon / sms example snippets


use Softon\Sms\Facades\Sms;  
 

// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','sms.test',['param1'=>'Name 1']);  
 

// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','Any Message Text To be sent.');  
 

// Params: [Array of MobileNumbers,Blade View Location,SMS Params If Required]
Sms::send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1']);  
 

/*****************************************************
 Gateways ::  log / clickatell / gupshup / mvaayoo / 
              smsachariya / smscountry / smslane / 
              nexmo / msg91 / mocker / custom 
*****************************************************/

Sms::gateway('mocker')->send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1']);  
 
// This command gives you the reply recieved from the server.
Sms::send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1'])->response();  
 
        'custom' => [                           // Can be used for any gateway
            'url' => '',                        // Gateway Endpoint
            'params' => [                       // Parameters to be [                   // Other Authentication params with their values
                    'uid' => '737262316a',
                    'pin' => 'YOURPIN',
                    'sender' => 'your_sender_id',
                    'route' => '0',
                    'pushid' => '1',
                ],
            ],
            'add_code' => true,                 // Append country code to the mobile numbers
        ],