PHP code example of tecdiary / sms

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

    

tecdiary / sms example snippets


composer 

use Tecdiary\Sms\Sms;

$config = [
    'gateway' => 'Log',
    'log' => [
        'path' => __DIR__ . '/logs/sms.log',
        'level' => 100
    ]
];

$sms = new Sms($config);
 

$sms->send('+919090909090', 'This is sms body');
 

$sms->send(['+60123456789', '+601111442122'], 'This is sms body');
 

$response = $sms->send(['+60123456789', '+601111442122'], 'This is sms body')->response();

$config = [
  'gateway' => 'Custom',
  'Custom' => [
    'url' => 'http://example.com/api/sms.php?',
    'params' => [
      'send_to_name' => 'mobile',
      'msg_name' => 'message',
      'others' => [
        'uid' => '737262316a',
        'pin' => 'YOURPIN',
        'sender' => 'your_sender_id',
        'route' => '0',
        'pushid' => '1',
      ]
    ]
  ]
];