PHP code example of justcoded / laravel-notification-channel-twilio

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

    

justcoded / laravel-notification-channel-twilio example snippets


public function routeNotificationForTwilio()
{
    return '+1234567890';
}

/config/twilio-notification-channel.php
 php
use Justcoded\NotificationChannelTwilio\TwilioChannel;
use Justcoded\NotificationChannelTwilio\TwilioSmsMessage;
use Illuminate\Notifications\Notification;

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

    public function toTwilio($notifiable)
    {
        return (new TwilioSmsMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}
 php
use Justcoded\NotificationChannelTwilio\TwilioChannel;
use Justcoded\NotificationChannelTwilio\TwilioMmsMessage;
use Illuminate\Notifications\Notification;

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

    public function toTwilio($notifiable)
    {
        return (new TwilioMmsMessage())
            ->content("Your {$notifiable->service} account was approved!")
            ->mediaUrl("https://picsum.photos/300");
    }
}