PHPackages                             carropublic/laraveltwilio - 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. carropublic/laraveltwilio

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

carropublic/laraveltwilio
=========================

A wrapper for Twilio SMS notification for Laravel

5.0.0(4y ago)2128.8k↓37%3[4 PRs](https://github.com/carro-public/laravel-twillo/pulls)MITPHPCI failing

Since Sep 12Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/carro-public/laravel-twillo)[ Packagist](https://packagist.org/packages/carropublic/laraveltwilio)[ Docs](https://github.com/carropublic/laraveltwilio)[ RSS](/packages/carropublic-laraveltwilio/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (23)Used By (0)

LaravelTwilio
=============

[](#laraveltwilio)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bcc69884f726bf5efcd925b83e2e5537ef5391917c9acaffb136dcee34c9d5ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636172726f7075626c69632f6c61726176656c7477696c696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carropublic/laraveltwilio)[![Total Downloads](https://camo.githubusercontent.com/9d31a1825fa4eeaf17bda03ab0087d268a680cb8ebc1c9994ddb838a2d813db5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636172726f7075626c69632f6c61726176656c7477696c696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carropublic/laraveltwilio)

A wrapper for Twilio SMS notification for Laravel. Take a look at [contributing.md](contributing.md) to see a to do list.

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

[](#installation)

Via Composer

```
$ composer require carropublic/laraveltwilio
```

Run the following vendor publish to publish Twillo config.

```
php artisan vendor:publish --tag=laraveltwilio.config
```

Update your `.env` for Twilio config in order to send out the SMS notification.

Usage
-----

[](#usage)

### LaravelNotification

[](#laravelnotification)

The following is the example usage of the package with Laravel's Notification.

#### Create Notification Class

[](#create-notification-class)

```
class ExampleNotification extends Notification
{
    // Which channel this notification should be sent to
    public function via($notifiable)
    {
        return [ SMSChannel::class, WhatsAppChannel::class ];
    }

    // Notification payload (content) will be sent
    public function toSMS($notifiable)
    {
        return new LaravelTwilioMessage("Message Content");
    }

    // Notification payload (content) will be sent
    public function toWhatsApp($notifiable)
    {
        return new LaravelTwilioMessage("Message Content");
    }
}

```

#### Create Notifiable Class

[](#create-notifiable-class)

```
class Contact extends Model {

    use Notifiable;

    // Phone number to receive
    public function routeNotificationForSms()
    {
        return $this->phone;
    }

    // Phone number to receive
    public function routeNotificationForWhatsapp()
    {
        return $this->phone;
    }
}

```

##### Sending Notification from Notifiable Instance

[](#sending-notification-from-notifiable-instance)

```
$contact->notify(new ExampleNotification());

```

##### Sending Notification from Anonymous Notifiable Instance

[](#sending-notification-from-anonymous-notifiable-instance)

```
Notification::route('sms')->notify(new ExampleNotification());

```

### Check incoming messages from Twilio

[](#check-incoming-messages-from-twilio)

When using webhook, you can validate the incoming request is from Twilio. `$token` is `config('laraveltwilio.auth_token')`. We are not using directly becuase it might be dynamic.

```
use CarroPublic\LaravelTwilio\Request\ValidateTwilioIncomingRequestSignature;

ValidateSignatureOfRequest::isValidRequest($token, $request);

```

Sandbox Mode
------------

[](#sandbox-mode)

#### How to enable SandBox Mode

[](#how-to-enable-sandbox-mode)

1. Register Closure to return if testing is enabled `\CarroPublic\LaravelTwilio\LaravelTwilioManager::registerTestingValidator`

Example:

```
LaravelTwilioManager::registerSandboxValidator(function () {
    return !is_production();
});

```

2. Otherwise, use`TWILIO_TESTING_ENABLE` to determine if running in sandbox mode. Default `false`

#### How to bypass sandbox $phone validator

[](#how-to-bypass-sandbox-phone-validator)

- Register Closure to return if sandbox is enabled `\CarroPublic\LaravelTwilio\LaravelTwilioSender::registerValidPhoneForSandbox`

Example:

```
LaravelTwilioSender::registerValidPhoneForSandbox(function ($phoneNumber) {
    return $phoneNumber == "+84111111111";
}

```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Carro](https://github.com/carropublic)
- [All Contributors](../../contributors%5D)

License
-------

[](#license)

Please see the [license file](license.md) for more information.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance53

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

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

Every ~164 days

Recently: every ~169 days

Total

17

Last Release

174d ago

Major Versions

3.0.1 → 4.0.02020-10-26

4.0.0 → 5.0.02022-03-08

4.0.2 → 6.0.0-beta2023-05-24

4.0.4 → 6.0.1-beta2024-01-18

0.1.x-dev → 4.0.52024-04-22

### Community

Maintainers

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

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

![](https://www.gravatar.com/avatar/170e8e0e4b2ce9b2768af2b02ab22cb615ed0f591f18061c8ab3686c49596936?d=identicon)[carro-tech](/maintainers/carro-tech)

![](https://www.gravatar.com/avatar/f2a97fcbee13f9514081883ddbd05ea295dfe71f62fa4b78421ad1a9f4e2d90f?d=identicon)[datpm.carro](/maintainers/datpm.carro)

---

Top Contributors

[![setkyar](https://avatars.githubusercontent.com/u/4435358?v=4)](https://github.com/setkyar "setkyar (15 commits)")[![datpmwork](https://avatars.githubusercontent.com/u/9279315?v=4)](https://github.com/datpmwork "datpmwork (13 commits)")[![tintaungkhant-genie](https://avatars.githubusercontent.com/u/172233844?v=4)](https://github.com/tintaungkhant-genie "tintaungkhant-genie (1 commits)")

---

Tags

laravellaravel-packagetwilio-sms-notificationlaravelLaravelTwilio

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/carropublic-laraveltwilio/health.svg)

```
[![Health](https://phpackages.com/badges/carropublic-laraveltwilio/health.svg)](https://phpackages.com/packages/carropublic-laraveltwilio)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[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)[therobfonz/laravel-mandrill-driver

Mandrill Driver for Laravel

773.5M](/packages/therobfonz-laravel-mandrill-driver)

PHPackages © 2026

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