PHPackages                             bbs-lab/twilio-notification-channel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. bbs-lab/twilio-notification-channel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

bbs-lab/twilio-notification-channel
===================================

Provides Twilio notification channel for Laravel

v3.1.2(4y ago)07MITPHPPHP &gt;=7.2

Since Jun 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/BBS-Lab/twilio-notification-channel)[ Packagist](https://packagist.org/packages/bbs-lab/twilio-notification-channel)[ RSS](/packages/bbs-lab-twilio-notification-channel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Twilio notifications channel for Laravel
========================================

[](#twilio-notifications-channel-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5d6ec37f4caeabe5c071208e59b126880fba46f7b43e7ee6f297ea200dea4bf9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f7477696c696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/twilio)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/6132dacedcb9a3cd3cdb87ddd38541990d46b45f9699a0aa60ff33e1080e491e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f7477696c696f2f5048503f7374796c653d666c61742d737175617265)](https://travis-ci.org/laravel-notification-channels/twilio)[![StyleCI](https://camo.githubusercontent.com/33a97da6ff9ecb88f5319fb154577a547442e8a889d897498883f7bb32eb486e/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353534333333392f736869656c64)](https://styleci.io/repos/65543339)[![Quality Score](https://camo.githubusercontent.com/bebfb8062f6f751ecc4ef723ff002d230d1e7e16b78a64658ddc19a4665285f0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f7477696c696f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/twilio)[![Code Coverage](https://camo.githubusercontent.com/9bd0ad108a6b971cbcd62b09ca7e52d120ef3e9b8772222265c83a95a97885eb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f7477696c696f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/twilio/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/9cd42cec08daf4da377b6ec8e91d588eee765431cd6498570ec3ab9b936dfaec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f7477696c696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/twilio)

This package makes it easy to send [Twilio notifications](https://documentation.twilio.com/docs) with Laravel 5.5+, 6.x and 7.x

You are viewing the `3.x` documentation. [Click here](https://github.com/laravel-notification-channels/twilio/tree/2.x) to view the `2.x` documentation.

Fork
====

[](#fork)

Original [repo](https://github.com/laravel-notification-channels/twilio) has disappeared

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require bbs-lab/twilio-notification-channel
```

### Configuration

[](#configuration)

Add your Twilio Account SID, Auth Token, and From Number (optional) to your `.env`:

```
TWILIO_USERNAME=XYZ # optional when using auth token
TWILIO_PASSWORD=ZYX # optional when using auth token
TWILIO_AUTH_TOKEN=ABCD # optional when using username and password
TWILIO_ACCOUNT_SID=1234 # always required
TWILIO_FROM=100000000 # optional default from
TWILIO_ALPHA_SENDER=HELLO # optional
TWILIO_DEBUG_TO=23423423423 # Set a number that call calls/messages should be routed to for debugging
TWILIO_SMS_SERVICE_SID=MG0a0aaaaaa00aa00a00a000a00000a00a # Optional but recommended
```

### Advanced configuration

[](#advanced-configuration)

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

```
/config/twilio-notification-channel.php

```

#### Suppressing specific errors or all errors

[](#suppressing-specific-errors-or-all-errors)

Publish the config using the above command, and edit the `ignored_error_codes` array. You can get the list of exception codes from [the documentation](https://www.twilio.com/docs/api/errors).

If you want to suppress all errors, you can set the option to `['*']`. The errors will not be logged but notification failed events will still be emitted.

#### Recommended Configuration

[](#recommended-configuration)

Twilio recommends always using a [Messaging Service](https://www.twilio.com/docs/sms/services) because it gives you access to features like Advanced Opt-Out, Sticky Sender, Scaler, Geomatch, Shortcode Reroute, and Smart Encoding.

Having issues with SMS? Check Twilio's [best practices](https://www.twilio.com/docs/sms/services/services-best-practices).

Upgrading from 2.x to 3.x
-------------------------

[](#upgrading-from-2x-to-3x)

If you're upgrading from version `2.x`, you'll need to make sure that your set environment variables match those above in the config section. None of the environment variable names have changed, but if you used different keys in your `services.php` config then you'll need to update them to match the above, or publish the config file and change the `env` key.

You should also remove the old entry for `twilio` from your `services.php` config, since it's no longer used.

The main breaking change between `2.x` and `3.x` is that failed notification will now throw an exception unless they are in the list of ignored error codes (publish the config file to edit these).

You can replicate the `2.x` behaviour by setting `'ignored_error_codes' => ['*']`, which will case all exceptions to be suppressed.

Usage
-----

[](#usage)

Now you can use the channel in your `via()` method inside the notification:

```
use NotificationChannels\Twilio\TwilioChannel;
use NotificationChannels\Twilio\TwilioSmsMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TwilioChannel::class];
    }

    public function toTwilio($notifiable)
    {
        return (new TwilioSmsMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}
```

You can also send an MMS:

```
use NotificationChannels\Twilio\TwilioChannel;
use NotificationChannels\Twilio\TwilioMmsMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TwilioChannel::class];
    }

    public function toTwilio($notifiable)
    {
        return (new TwilioMmsMessage())
            ->content("Your {$notifiable->service} account was approved!")
            ->mediaUrl("https://picsum.photos/300");
    }
}
```

Or create a Twilio call:

```
use NotificationChannels\Twilio\TwilioChannel;
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 TwilioCallMessage())
            ->url("http://example.com/your-twiml-url");
    }
}
```

In order to let your Notification know which phone are you sending/calling to, the channel will look for the `phone_number` attribute of the Notifiable model. If you want to override this behaviour, add the `routeNotificationForTwilio` method to your Notifiable model.

```
public function routeNotificationForTwilio()
{
    return '+1234567890';
}
```

### Available Message methods

[](#available-message-methods)

#### TwilioSmsMessage

[](#twiliosmsmessage)

- `from('')`: Accepts a phone to use as the notification sender.
- `content('')`: Accepts a string value for the notification body.
- `messagingServiceSid('')`: Accepts a messaging service SID to handle configuration.

#### TwilioCallMessage

[](#twiliocallmessage)

- `from('')`: Accepts a phone to use as the notification sender.
- `url('')`: Accepts an url for the call TwiML.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Gregorio Hernández Caso](https://github.com/gregoriohc)
- [atymic](https://github.com/atymic)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1793d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1edc17683ed39a2cc6dbe453c2c5aaa63468fc5b54f13941f260ebe260da211?d=identicon)[Kezho](/maintainers/Kezho)

---

Top Contributors

[![mikaelpopowicz](https://avatars.githubusercontent.com/u/5689944?v=4)](https://github.com/mikaelpopowicz "mikaelpopowicz (2 commits)")

---

Tags

laravelnotificationsmstwiliocallmms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bbs-lab-twilio-notification-channel/health.svg)

```
[![Health](https://phpackages.com/badges/bbs-lab-twilio-notification-channel/health.svg)](https://phpackages.com/packages/bbs-lab-twilio-notification-channel)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[simplesoftwareio/simple-sms

Simple-SMS is a package made for Laravel to send/receive (polling/pushing) text messages. Currently supports CalLFire, EZTexting, Email Gateways, FlowRoute, LabsMobile, Mozeo, Nexmo, Plivo, Twilio, and Zenvia

20845.7k5](/packages/simplesoftwareio-simple-sms)[ghanem/laravel-smsmisr

Send SMS and SMS Notification via SMS Misr for Laravel

194.8k](/packages/ghanem-laravel-smsmisr)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
