PHP code example of toriqahmads / sms-viro

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

    

toriqahmads / sms-viro example snippets


use Toriqahmads\SmsViro\SmsViro;

$smsviro = new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp');
$smsviro->sendSms('089668639048', 'Your otp code is 6989');
var_dump($smsviro->isRequestSuccess());

...
use Toriqahmads\SmsViro\SmsViro;

class OptimusServiceProvider extends ServiceProvider
{
    public function register()
    {
        ...
        $this->app->singleton(SmsViro::class, function ($app) {
            return new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp');
        });
    }
...

...
use Toriqahmads\SmsViro\SmsViro;

class TestController extends Controller
{
    public function sendSms(SmsViro $smsviro)
    {
        $smsviro->sendSms('089668639048', 'Your otp code is 6989');
        $smsviro->isRequestSuccess();
    }
}
...
 php
...
$smsviro = new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp');
$smsviro->sendSms('089668639048', 'Your otp code is 6989');
$smsviro->isRequestSuccess();
...