PHP code example of novinvision / iranian-laravel-sms

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

    

novinvision / iranian-laravel-sms example snippets




namespace App\Notifications;

use NovinVision\IranianLaravelSMS\Messages\SmsMessage;
use Illuminate\Notifications\Notification;

class SmsTest extends Notification
{
    public function via($notifiable)
    {
        return ['sms'];
    }

    public function toSms(object $notifiable): SmsMessage
    {
        return (new SmsMessage)
            ->line(sprintf("Dear %s", $notifiable->name))
            ->line("It is Test Sms Message");
    }
}

public function routeNotificationForSms(): ?string
{
    return $this->mobile;
}

$user->notify(new \App\Notifications\SmsTest());