Package

Laravel Notification Channels Twilio

Provides Twilio notification channel for Laravel

Package

laravel-notification-channels/twilio

View on GitHub →

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 Twilio Related Articles

Sending Notifications with Laravel image

Sending Notifications with Laravel

Read article
Laravel Notification Channels image

Laravel Notification Channels

Read article
Auto Publishing to Telegram using Notification Channels image

Auto Publishing to Telegram using Notification Channels

Read article
New Community Project: Laravel Notification Channels image

New Community Project: Laravel Notification Channels

Read article
Build an MMS Ticketing System Using PHP, Laravel and Twilio image

Build an MMS Ticketing System Using PHP, Laravel and Twilio

Read article
Laravel Web Push Notifications image

Laravel Web Push Notifications

Read article

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

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

PhpStorm

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

PhpStorm

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum

Shift

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

Shift

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing