PHP code example of mahdigraph / laravel-sms

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

    

mahdigraph / laravel-sms example snippets


// In your providers array.
'providers' => [
    ...
    \Metti\LaravelSms\LaravelSMSServiceProvider::class,
],

// In your aliases array.
'aliases' => [
    ...
    'SendSMS' => \Metti\LaravelSms\Facade\SendSMS::class,
],

// Eg. if you want to use ippanel.
'default' => 'ippanel',

'drivers' => [
    'ippanel' => [
        // Fill in the credentials here.
        'key' => '00000000-0000-0000-0000-000000000000', // API Key
        'originator' => '+9890000', // Sender Number
        'patterns' => [ // patterns only if you want to use them.
            'contact' => [ // pattern name
                'pattern_code' => 'abcd-efgh-ijkl-mnop', // pattern code from your sms provider
                'values' => [ // values only if you want to set default values for your patterns.
                    'support_phone' => '021-123456789'
                ]
            ]
        ] 
    ],
    ...
]

// Sending Text Messages
SendSMS::textMessage('Hey You :)')
    ->recipients(['09121234567','09121234568'])
    ->send();

// Sending Pattern Messages
SendSMS::via('ippanel')
    ->patternMessage('contact',['support_phone' => '021-123456789'])
    ->recipients('09121234567')
    ->send();