PHP code example of jishanhoshen / laravel-sms

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

    

jishanhoshen / laravel-sms example snippets


use JishanHoshen\LaravelSms\Facades\Sms;

Sms::send('Your OTP is 1234', '01712345678');

Sms::provider('twilio')->send('Your OTP is 1234', '01712345678');
Sms::provider('alpha_sms')->send('Your OTP is 1234', '01712345678');

use JishanHoshen\LaravelSms\Contracts\SmsServiceInterface;

class SomeController
{
    public function __construct(protected SmsServiceInterface $sms) {}

    public function notify()
    {
        $this->sms->send('Your OTP is 1234', '01712345678');
    }
}

app('sms')->provider('twilio')->send('Hello', '01712345678');

app('sms')->extend('my_gateway', \App\Sms\MyGatewayProvider::class);
bash
php artisan vendor:publish --tag=sms-config