1. Go to this page and download the library: Download laraditz/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/ */
laraditz / twilio example snippets
public function routeNotificationForTwilio($notification)
{
return $this->mobile_no;
}
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Laraditz\Twilio\TwilioChannel;
use Laraditz\Twilio\TwilioWhatsappMessage;
class TestNotification extends Notification
{
use Queueable;
public function via($notifiable)
{
return [TwilioChannel::class];
}
public function toTwilio($notifiable)
{
return (new TwilioWhatsappMessage())
->content("Test Whatsapp message!")
->mediaUrl("https://news.tokunation.com/wp-content/uploads/sites/5/2022/07/Kamen-Rider-Geats-Teaser.jpeg");
}
}
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Laraditz\Twilio\TwilioChannel;
use Laraditz\Twilio\TwilioSmsMessage;
class TestNotification extends Notification
{
use Queueable;
public function via($notifiable)
{
return [TwilioChannel::class];
}
public function toTwilio($notifiable)
{
return (new TwilioSmsMessage())
->content("Test SMS message!");
}
}