dev-master
9999999-devTwilio SMS driver for Laravel Notifications
MIT
The Requires
by Sid
laravel sms twilio notifications
Wallogit.com
2017 © Pedro Peláez
Twilio SMS driver for Laravel Notifications
Twilio driver for sending SMS with Laravel Notifications., (*1)
This is pretty much a port of Laravel's default SMS driver., (*2)
Install with composer - composer require koomai/laravel-twilio-sms. This also installs the aloha/twilio package., (*3)
Add 'Aloha\Twilio\Support\Laravel\ServiceProvider'::class to config/app.php, (*4)
Publish the config file php artisan vendor:publish, (*5)
Go to config/twilio.php and add your Twilio credentials plus the number you're sending from. Hint: Use the .env file., (*6)
Follow Laravel's documentation to add the channel to the via method and create a representation of the notification., (*7)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [TwilioSmsChannel::class];
}
/**
* Get the SMS representation of the notification.
*
* @param mixed $notifiable
* @return TwilioMessage
*/
public function toTwilio($notifiable)
{
return (new TwilioMessage)
->content('This is a test SMS via Plivo using Laravel Notifications!');
// ->from('+61455222900'); Chain this method to override default 'from' number
}
Twilio SMS driver for Laravel Notifications
MIT
laravel sms twilio notifications