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

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

justcoded/laravel-notification-channel-twilio
=============================================

Provides Twilio notification channel for Laravel

3.1.2(4y ago)05.8kPHPPHP &gt;=7.2

Since Jun 15Pushed 4y agoCompare

[ Source](https://github.com/justcoded/laravel-notification-channel-twilio)[ Packagist](https://packagist.org/packages/justcoded/laravel-notification-channel-twilio)[ RSS](/packages/justcoded-laravel-notification-channel-twilio/feed)WikiDiscussions main Synced yesterday

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

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

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

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)

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

[](#installation)

You can install the package via composer:

```
composer require justcoded/laravel-notification-channel-twilio
```

### 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="Justcoded\NotificationChannelTwilio\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 Justcoded\NotificationChannelTwilio\TwilioChannel;
use Justcoded\NotificationChannelTwilio\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 Justcoded\NotificationChannelTwilio\TwilioChannel;
use Justcoded\NotificationChannelTwilio\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 Justcoded\NotificationChannelTwilio\TwilioChannel;
use Justcoded\NotificationChannelTwilio\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.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

1792d ago

### Community

Maintainers

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

---

Top Contributors

[![aprokopenko](https://avatars.githubusercontent.com/u/1842666?v=4)](https://github.com/aprokopenko "aprokopenko (1 commits)")[![KolyaSirik](https://avatars.githubusercontent.com/u/11480548?v=4)](https://github.com/KolyaSirik "KolyaSirik (1 commits)")

---

Tags

laravelnotificationsmstwiliocallmms

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/justcoded-laravel-notification-channel-twilio/health.svg)](https://phpackages.com/packages/justcoded-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)
