PHPackages                             stuyam/laravel-phone-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. stuyam/laravel-phone-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

stuyam/laravel-phone-validator
==============================

A phone validator for Laravel using the free Twilio phone lookup service.

1.0.10(3y ago)2861.3k—2.8%8MITPHP

Since Jul 13Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/stuyam/laravel-phone-validator)[ Packagist](https://packagist.org/packages/stuyam/laravel-phone-validator)[ RSS](/packages/stuyam-laravel-phone-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (12)Used By (0)

Lavarel Phone Validator
=======================

[](#lavarel-phone-validator)

[![Packagist](https://camo.githubusercontent.com/d9e3e1ce11e2843464df379c810fc63d3e5424122316b25a6681fa651b3d791d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73747579616d2f6c61726176656c2d70686f6e652d76616c696461746f722e737667)](https://packagist.org/packages/stuyam/laravel-phone-validator)[![Packagist](https://camo.githubusercontent.com/0061cba660cdc746d5552947a0bddd0261ea9cfc1c5387693fca0bfb67a51e22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73747579616d2f6c61726176656c2d70686f6e652d76616c696461746f722e737667)](https://packagist.org/packages/stuyam/laravel-phone-validator)

A phone validator for Laravel using the FREE [Twilio phone lookup service](https://www.twilio.com/lookup)

This custom validator validates that a phone number actual exists. Not just if it has a specific format or not, but if the phone number is a real registered phone number. It is smart enough to handle formated numbers like `(123)-555-1234` and unfromated numbers like `1235551234` so users can enter in a phone number however they are most comfortable.

For a working example check out [Laravel Validator Example](https://github.com/stuyam/validators) project.

Also see: [Laravel Kickbox Validator](https://github.com/stuyam/laravel-kickbox-validator) for email address validation.

### Step 1

[](#step-1)

Install via composer:

```
composer require stuyam/laravel-phone-validator

```

### Step 2

[](#step-2)

Add to your `config/app.php` service provider list:

```
StuYam\PhoneValidator\PhoneValidatorServiceProvider::class
```

### Step 3

[](#step-3)

Add Twilio credentials to your .env file:

(If you don't have a Twilio account you can go to [Twilio.com](https://www.twilio.com/) and make a free account)

```
TWILIO_SID=xxxxxxxx
TWILIO_TOKEN=xxxxxxxx

```

### Usage

[](#usage)

Add the string 'phone' to a form request rules or validator like so:

```
