PHP code example of shipu / muthofun-sms-gateway

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

    

shipu / muthofun-sms-gateway example snippets


Shipu\MuthoFun\MuthoFunServiceProvider::class,

'MUTHOFUN'   =>  Shipu\MuthoFun\Facades\MuthoFun::class,

use Shipu\MuthoFun\MUTHOFUN;

$config = [
    'username' => 'Your Username',
    'password' => 'Your Password'
];

$sms = new MUTHOFUN($config);

return [
    'username' => 'Your Username',
    'password' => 'Your Password'
];

use \Shipu\MuthoFun\MuthoFun;

...

$sms = new MUTHOFUN($config);
$response = $sms->message('your text here !!!', '01606022000')->send(); // Guzzle Response with request data

// For another example please see below laravel section. 
 
return $response->autoParse(); // Getting only response contents.

use \Shipu\MuthoFun\Facades\MuthoFun;

...

$sms = MUTHOFUN::message('your text here !!!', '01606022000')->send(); // Guzzle Response with request data

// or

$sms = MUTHOFUN::message('your text here !!!')->to('01606022000')->send();

// or

$sms = MUTHOFUN::send(
    [
        'message' => "your text here",
        'to' => '01616022000'
    ]
);
return $sms->autoParse(); // Getting only response contents.

$sms = MUTHOFUN::message('your text here !!!')
            ->to('01616022669')
            ->to('01845736124')
            ->to('01745987364')
            ->send();
            
// or you can try below statements also

$sms = MUTHOFUN::message('your text here !!!', '01616022669')
            ->to('01845736124')
            ->to('01745987364')
            ->send();
            
// or           

$users = [
    '01616022669',
    '01845736124',
    '01745987364'
];        
$sms = MUTHOFUN::message('your text here !!!',$users)->send(); 

$sms = MUTHOFUN::message('your text here one !!!')->to('01616022669')
            ->message('your text here two !!!')->to('01845736124')
            ->message('your text here three !!!')->to('01745987364')
            ->send();
// or

$sms = MUTHOFUN::message('your text here one !!!', '01616022669')
            ->message('your text here two !!!', '01845736124')
            ->message('your text here three !!!', '01745987364')
            ->send();
            
// or 

$sms = MUTHOFUN::send([
    [
        'message' => "your text here one !!!",
        'to' => '01616022669'
    ],
    [
        'message' => "your text here two !!!",
        'to' => '01707722669'
    ],
    [
        'message' => "your text here three !!!",
        'to' => '01745987364'
    ]
]);

// or 

$sms = MUTHOFUN::message('your text here one !!!', '01616022669')->send([
    [
        'message' => "your text here two !!!",
        'to' => '01707722669'
    ],
    [
        'message' => "your text here three !!!",
        'to' => '01745987364'
    ]
]);         

$users = [
    ['01670420420', ['Nahid', '1234']],
    ['01970420420', ['Rana', '3213']],
    ['01770420420', ['Shipu', '5000']],
    ['01570420420', ['Kaiser', '3214']],
    ['01870420420', ['Eather', '7642']]
]
$sms = new \Shipu\MuthoFun\MUTHOFUN(config('muthofun'));
$msg = $sms->message("Hello %s , Your promo code is: %s", $users)->send();

// or 

$users = [
    '01670420420' => ['Nahid', '1234'],
    '01970420420' => ['Rana', '3213'],
    '01770420420' => ['Shipu', '5000'],
    '01570420420' => ['Kaiser', '3214'],
    '01870420420' => ['Eather', '7642']
]
$sms = new \Shipu\MuthoFun\MUTHOFUN(config('muthofun'));
$msg = $sms->message("Hello %s , Your promo code is: %s", $users)->send();

$sms = MUTHOFUN::numberPrefix('91')->message('your text here !!!', '01606022000')->send();

$sms = MUTHOFUN::debug(true)->message('your text here !!!', '01606022000')->send();

$sms = MUTHOFUN::autoParse(true)->message('your text here !!!', '01606022000')->send();

$sms = MUTHOFUN::template(false)->message('your text here !!!', '01606022000')->send();

$sms->autoParse();

SimpleXMLElement {#212 ▼
    +"sms": SimpleXMLElement {#216 ▼
        +"smsclientid": "713231739"
        +"messageid": "500930552"
        +"mobile-no": "+8801616022669"
}
shell
php artisan vendor:publish --provider="Shipu\MuthoFun\MuthoFunServiceProvider"