PHP code example of alizne / smsapi

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

    

alizne / smsapi example snippets


use Alizeinodin\SmsApi\Facades\Sms;

Sms::send('09121234567', 'Your order was placed.');

Sms::failover(['smsir', 'kavenegar'])->send('09121234567', 'Hello');

Sms::template('otp-login')->to($user)->send(['CODE' => '12345']);

// Email instead of SMS, or both
Sms::otp('otp-login')->to($user)->mail()->send(['CODE' => '12345']);
Sms::otp('otp-login')->to($user)->both()->send(['CODE' => '12345']);

Sms::challenge('login')->template('otp-login')->to($user)->send();

Sms::challenge('login')->check($user, $request->input('code'));

Sms::queue('otp')->sendTemplate('09121234567', 'otp-login', ['CODE' => '12345']);

Sms::template('otp-login')->to($user)->queue('otp')->send(['CODE' => '12345']);
Sms::template('otp-login')->to($user)->sync()->send(['CODE' => '12345']);

use Alizeinodin\SmsApi\Notifications\NotificationMessage;

public function via($notifiable): array
{
    return ['sms'];
}

public function toSms($notifiable): NotificationMessage
{
    return NotificationMessage::create()
        ->template('otp-login', ['CODE' => $this->code]);
}

Sms::fake();

Sms::send('09121234567', 'test');

Sms::assertSentTo('09121234567');
Sms::assertNothingSent();
bash
php artisan smsapi:install logging
php artisan smsapi:install otp
php artisan smsapi:install resilience
php artisan smsapi:install all
bash
php artisan smsapi:install otp