PHPackages                             ivansotelo/twilio-verify - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ivansotelo/twilio-verify

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ivansotelo/twilio-verify
========================

Verify Phone Numbers in a Laravel PHP Application with Twilio Verify

v1.4.2(1y ago)525.1k4MITPHPPHP &gt;=7.2|^8.0CI failing

Since Jul 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/IvanSotelo/TwilioSmsVerification)[ Packagist](https://packagist.org/packages/ivansotelo/twilio-verify)[ RSS](/packages/ivansotelo-twilio-verify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (16)Used By (0)

TwilioVerify
============

[](#twilioverify)

[![Build Status](https://github.com/IvanSotelo/TwilioSmsVerification/workflows/tests/badge.svg)](https://github.com/IvanSotelo/TwilioSmsVerification/actions)[![Total Downloads](https://camo.githubusercontent.com/eecfdd756989f4c779dcb107ecc5f3c47fadb8d545daf710911520a259e80537/68747470733a2f2f706f7365722e707567782e6f72672f6976616e736f74656c6f2f7477696c696f2d7665726966792f642f746f74616c2e737667)](https://packagist.org/packages/ivansotelo/twilio-verify)[![Latest Stable Version](https://camo.githubusercontent.com/cc7fa25d8acc5ee74f471948e0218f62a23e3c9e5a4d9f050a872e6e54bf60f1/68747470733a2f2f706f7365722e707567782e6f72672f6976616e736f74656c6f2f7477696c696f2d7665726966792f762f737461626c652e737667)](https://packagist.org/packages/ivansotelo/twilio-verify)[![License](https://camo.githubusercontent.com/199e4632a24fd7af197fdd1eb88414b48e437d5b2a3c61865f9134dcb44735f9/68747470733a2f2f706f7365722e707567782e6f72672f6976616e736f74656c6f2f7477696c696f2d7665726966792f6c6963656e73652e737667)](https://packagist.org/packages/ivansotelo/twilio-verify)

Introduction
------------

[](#introduction)

TwilioVerify makes it easier and safer than custom verification systems to verify a user’s phone number. It ensures that the phone number is valid by sending a short code via SMS to the number during registration. This can help reduce the number of fake accounts created and failure rates when sending SMS notifications to users.

This package use [Twilio notifications channel](https://github.com/laravel-notification-channels/twilio).

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your Twilio account](#setting-up-your-twilio-account)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require ivansotelo/twilio-verify
```

In app/config/app.php add the following :

```
IvanSotelo\TwilioVerify\TwilioVerifyServiceProvider::class,
```

### 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 # otional default from
TWILIO_ALPHA_SENDER=HELLO # optional
TWILIO_DEBUG_TO=23423423423 # Set a number that call calls/messages should be routed to for debugging
```

### Advanced configuration

[](#advanced-configuration)

Run `php artisan vendor:publish --provider="IvanSotelo\TwilioVerify\TwilioVerifyServiceProvider" --tag=config`

```
/config/twilio-verify.php

```

To run the migrations from this package use the following command:

```
php artisan migrate --path="/vendor/ivansotelo/twilio-verify/database/migrations"

```

The package by default use the `App\User:class` to get the table name.

To customize the migration, publish it with the following command:

```
php artisan vendor:publish --provider="IvanSotelo\TwilioVerify\TwilioVerifyServiceProvider" --tag="migrations"

```

Twilio Verify assumes your MustVerifyPhone trait will be the App\\User class that ships with Laravel. If you wish to change this you can specify a different model in your .env file:

```
TWILIO_VERIFY_MODEL=App\User

```

Usage
-----

[](#usage)

Add the MustVerifyPhone trait to your model definition. This trait provides various methods to allow you to send verification phone code.

```
use IvanSotelo\TwilioVerify\Traits\MustVerifyPhone;
use IvanSotelo\TwilioVerify\Contracts\MustVerifyPhoneContract;

class User extends Authenticatable implements MustVerifyPhoneContract
{
    use MustVerifyPhone, Notifiable;

    /**
     * Route notifications for the Twilio channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForTwilio()
    {
        return $this->phone_number;
    }

}
```

On EventServiceProvider attach SendPhoneVerificationNotification to the Illuminate\\Auth\\Events\\Registered event:

```
namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Verified;
use Illuminate\Auth\Events\Registered;
use IvanSotelo\TwilioVerify\Listeners\SendPhoneVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        Registered::class => [
            SendPhoneVerificationNotification::class,
        ],
        Verified::class => [
            // You can attach some listener
        ],
    ];
}
```

To register the default middleware add the following lines to the `$routeMiddleware` array within the `app/Http/Kernel.php` file:

```
protected $routeMiddleware = [
    // …
    'isVerified' => \IvanSotelo\TwilioVerify\Http\Middleware\EnsurePhoneIsVerified::class,
```

Apply the middleware on your routes:

```
Route::group(['middleware' => ['isVerified']], function () {
    // …
```

By default this packages ships with two routes.

```
Route::get('phone/verify/{code}', 'VerificationController@verify')->name('verification.verify');
Route::post('phone/resend', 'VerificationController@resend')->name('verification.resend');
```

To customize the translations you may publish the files to your `resources/lang/vendor` folder using the following command:

```
php artisan vendor:publish --provider="IvanSotelo\TwilioVerify\TwilioVerifyServiceProvider" --tag="translations"

```

License
-------

[](#license)

TwilioVerify is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 97.9% 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 ~105 days

Recently: every ~58 days

Total

15

Last Release

649d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.2

v1.4.0PHP &gt;=7.2|^8.0

### Community

Maintainers

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

---

Top Contributors

[![IvanSotelo](https://avatars.githubusercontent.com/u/2218681?v=4)](https://github.com/IvanSotelo "IvanSotelo (46 commits)")[![bk-ty](https://avatars.githubusercontent.com/u/148463831?v=4)](https://github.com/bk-ty "bk-ty (1 commits)")

---

Tags

laravelverifysmstwilio

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ivansotelo-twilio-verify/health.svg)

```
[![Health](https://phpackages.com/badges/ivansotelo-twilio-verify/health.svg)](https://phpackages.com/packages/ivansotelo-twilio-verify)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

324339.9k4](/packages/casbin-laravel-authz)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[tzsk/sms

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

320244.3k6](/packages/tzsk-sms)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

2737.5k](/packages/scaler-tech-laravel-saml2)

PHPackages © 2026

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