PHP code example of sagordev / powersms-gateway

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

    

sagordev / powersms-gateway example snippets


return [
    'user_id' => 'YOUR_USER_ID',
    'password' => 'YOUR_PASSWORD',
    'url' => '' // You can keep it blank
];

use Sagordev\PowersmsGateway\Facades\PowerSms;

PowerSms::message('This is a test SMS', '01234567890')->send();
// You can also send list of numbers (ex: ['01234567890', '01234567891'])

PowerSms::message('This is test SMS')
        ->to(['01234567890', '01234567891'])
        ->send();

PowerSms::message('I am SMS with carbon copy to developer')
        ->to(['01234567890', '01234567891'])
        ->cc(['01234567892'])
        ->send();

PowerSms::send([
    'message' => 'Hey, This is another SMS',
    'to' => ['01234567890', '01234567891'],
]);

PowerSms::send([
      [
          'message' => 'Dear Customer, Your invitation code is #3310',
          'to' => ['01234567890', '01234567891'],
      ],
      [
          'message' => 'Dear Customer, Your invitation code is #0950',
          'to' => '01234567892',
      ]
]);

use Sagordev\PowersmsGateway\PowerSms;

$config = [
    'user_id' => 'YOUR_USER_ID',
    'password' => 'YOUR_PASSWORD',
    'url' => '' // You can keep it blank
];

$sms = new PowerSms($config);
$sms->message('Hello', '01234567890')->send();

// Example 2
$sms->message('I am SMS with carbon copy to developer')
        ->to(['01234567890', '01234567891'])
        ->cc(['01234567892'])
        ->send();
// Please look at the previous examples for more fun

 php artisan vendor:publish --provider="Sagordev\PowersmsGateway\Providers\PowerSmsGatewayServiceProvider"