The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

Twilio

laravel-notification-channels/twilio image

Twilio stats

Downloads
3M
Stars
196
Open Issues
19
Forks
29

View on GitHub →

Provides Twilio notification channel for Laravel

Twilio Notifications Channel for Laravel

The Twilio Notifications Channel for Laravel enables convenient integration with Twilio for sending notifications via SMS, MMS, or voice calls. This package is compatible with Laravel versions 5.5 and higher, including the latest releases.

Main Features

  • Send SMS, MMS, and Voice Calls: Easily send notifications as text messages, multimedia messages, or voice calls.
  • Flexible Notification Routing: Decide how notifications are sent based on notifiable entities in your application.
  • Configurable Error Handling: Choose to log specific errors or suppress all errors for streamlined debugging and production readiness.
  • Advanced Configuration Options: Customize behavior through environmental variables or a published configuration file.
  • Support for Twilio’s Messaging Services: Utilize features like Advanced Opt-Out, Sticky Sender, and Smart Encoding by configuring a Messaging Service SID.

Installation and Configuration

  1. Installation via Composer:

    composer require laravel-notification-channels/twilio
  2. Environment Configuration: Add Twilio credentials to your .env file:

    TWILIO_ACCOUNT_SID=1234
    TWILIO_AUTH_TOKEN=ABCD
    TWILIO_FROM=100000000
  3. Publish Configuration (optional for advanced settings):

    php artisan vendor:publish --provider="NotificationChannels\Twilio\TwilioProvider"

Usage

Implement notifications in your Laravel application using Twilio by specifying TwilioChannel in the via() method of your notification class. You can send SMS, MMS, or initiate Twilio calls:

use NotificationChannels\Twilio\TwilioSmsMessage;
use NotificationChannels\Twilio\TwilioMmsMessage;
use NotificationChannels\Twilio\TwilioCallMessage;
use Illuminate\Notifications\Notification;
 
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [TwilioChannel::class];
}
 
public function toTwilio($notifiable)
{
return (new TwilioSmsMessage())
->content("Your account was approved!");
}
}

Additional Details

  • Error Handling: Manage how errors are reported by editing the ignored_error_codes in the published configuration file.
  • Testing and Security: Run tests using composer test. Report security issues directly via the provided email.
  • Upgrading: When upgrading from version 2.x to 3.x, ensure your environmental settings are correctly aligned with the new requirements.

This package is maintained by a community of contributors and is licensed under the MIT License. For a comprehensive guide, including a list of available message methods and detailed configuration options, refer to the full package documentation.

laravel-notification-channels photo

A collection of custom notification drivers for Laravel

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Laravel Notification Channels Twilio Related Articles

Laravel 12.51.0 Adds afterSending Callbacks, Validator whenFails, and MySQL Timeout image

Laravel 12.51.0 Adds afterSending Callbacks, Validator whenFails, and MySQL Timeout

Read article
Get insights into all your Laravel notifications with Paragraphs new package image

Get insights into all your Laravel notifications with Paragraphs new package

Read article
How we automatically share new content on social media image

How we automatically share new content on social media

Read article
Laravel 9.44 is released with native support for changing database columns and more image

Laravel 9.44 is released with native support for changing database columns and more

Read article
Sending Notifications with Laravel image

Sending Notifications with Laravel

Read article
Laravel 9.12 Released image

Laravel 9.12 Released

Read article
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm