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
Tinkerwell logo

Tinkerwell

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

Tinkerwell
Lucky Media logo

Lucky Media

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

Lucky Media
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian