PHP code example of nuwira / laravel-sms-notification

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

    

nuwira / laravel-sms-notification example snippets


// config/app.php
'providers' => [
    ...
    Nuwira\LaravelSmsNotification\SmsServiceProvider::class,
],

namespace App\Notifications;

use Nuwira\LaravelSmsNotification\SmsChannel;
use Nuwira\LaravelSmsNotification\SmsMessage;
use Illuminate\Notifications\Notification;

class SendNotificationToSms extends Notification
{
    public function via($notifiable)
    {
        return [SmsChannel::class];
    }

    public function toSms($notifiable)
    {
        return (new SmsMessage())
            ->to($phoneNumber)
            ->content($content);
    }
}
console
php artisan vendor:publish --provider="Nuwira\LaravelSmsNotification\SmsServiceProvider"