PHPackages                             safermobility/laravel-notification-channel-twilio - 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. safermobility/laravel-notification-channel-twilio

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

safermobility/laravel-notification-channel-twilio
=================================================

Provides Twilio notification channel for Laravel

7.0.1(3mo ago)01.9k↑40%MITPHPPHP ^8.2CI failing

Since Sep 27Pushed 3mo agoCompare

[ Source](https://github.com/safermobility/laravel-notification-channel-twilio)[ Packagist](https://packagist.org/packages/safermobility/laravel-notification-channel-twilio)[ RSS](/packages/safermobility-laravel-notification-channel-twilio/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (13)Used By (0)

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b256edc03f3532f356f76e654a1623ffc534de180366fbc8b65f11ebc2e1333/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616665726d6f62696c6974792f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d7477696c696f2e737667)](https://packagist.org/packages/safermobility/laravel-notification-channel-twilio)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Build Status](https://github.com/safermobility/laravel-notification-channel-twilio/actions/workflows/ci.yml/badge.svg)](https://github.com/safermobility/laravel-notification-channel-twilio/actions/workflows/ci.yml)[![Total Downloads](https://camo.githubusercontent.com/331f1744ca578e4fea80642c2405d1eae6b4a37d61018a262cc4f779a03d8d07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616665726d6f62696c6974792f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d7477696c696f2e737667)](https://packagist.org/packages/safermobility/laravel-notification-channel-twilio)

This package makes it easy to send [Twilio notifications](https://documentation.twilio.com/docs) with Laravel 11.x

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 laravel-notification-channels/twilio
```

### Configuration

[](#configuration)

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

```
TWILIO_AUTH_TOKEN=ABCD
TWILIO_ACCOUNT_SID=1234 # always required
TWILIO_SID=5678 # allow using separate access tokens
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
TWILIO_SHORTEN_URLS=true # optional, enable URL shortener
```

### 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 3.x to 4.x
-------------------------

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

We have dropped support for PHP &lt; 8.2 and the minimum Laravel version is now 11. Other than that, there are no breaking changes.

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)

- [Philip Iezzi (Pipo)](https://github.com/onlime)
- [Pascal Baljet](https://github.com/pascalbaljet)
- [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

48

—

FairBetter than 94% of packages

Maintenance81

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Every ~77 days

Recently: every ~26 days

Total

12

Last Release

102d ago

Major Versions

4.0.1 → 5.0.02024-12-11

5.2.0 → 6.0.02025-08-14

6.0.4 → 7.0.02026-01-30

PHP version history (2 changes)4.0.0PHP ^8.1

5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0759b5eeafda005bac38df0e39cab4d3c6ec4cedebe9008b5df2cafccb8651ef?d=identicon)[kohenkatz](/maintainers/kohenkatz)

---

Top Contributors

[![gregoriohc](https://avatars.githubusercontent.com/u/566841?v=4)](https://github.com/gregoriohc "gregoriohc (43 commits)")[![kohenkatz](https://avatars.githubusercontent.com/u/88755?v=4)](https://github.com/kohenkatz "kohenkatz (25 commits)")[![onlime](https://avatars.githubusercontent.com/u/2759561?v=4)](https://github.com/onlime "onlime (22 commits)")[![lnpbk](https://avatars.githubusercontent.com/u/608543?v=4)](https://github.com/lnpbk "lnpbk (14 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (9 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (7 commits)")[![fwartner](https://avatars.githubusercontent.com/u/6692500?v=4)](https://github.com/fwartner "fwartner (5 commits)")[![pascalbaljet](https://avatars.githubusercontent.com/u/8403149?v=4)](https://github.com/pascalbaljet "pascalbaljet (5 commits)")[![mikemclin](https://avatars.githubusercontent.com/u/1570155?v=4)](https://github.com/mikemclin "mikemclin (5 commits)")[![ajcastro](https://avatars.githubusercontent.com/u/4918318?v=4)](https://github.com/ajcastro "ajcastro (4 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (3 commits)")[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (2 commits)")[![shahvirag](https://avatars.githubusercontent.com/u/24240840?v=4)](https://github.com/shahvirag "shahvirag (2 commits)")[![casperboone](https://avatars.githubusercontent.com/u/15815208?v=4)](https://github.com/casperboone "casperboone (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![themsaid](https://avatars.githubusercontent.com/u/4332182?v=4)](https://github.com/themsaid "themsaid (1 commits)")[![alexpotter](https://avatars.githubusercontent.com/u/9264694?v=4)](https://github.com/alexpotter "alexpotter (1 commits)")[![cmgmyr](https://avatars.githubusercontent.com/u/4693481?v=4)](https://github.com/cmgmyr "cmgmyr (1 commits)")[![hameesakhan](https://avatars.githubusercontent.com/u/32523517?v=4)](https://github.com/hameesakhan "hameesakhan (1 commits)")[![harlan-zw](https://avatars.githubusercontent.com/u/5326365?v=4)](https://github.com/harlan-zw "harlan-zw (1 commits)")

---

Tags

laravelnotificationsmstwiliocallmms

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  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)
