Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stuyam/laravel-phone-validator
A phone validator for Laravel using the free Twilio phone lookup service.
https://github.com/stuyam/laravel-phone-validator
laravel packagist php twilio
Last synced: 6 days ago
JSON representation
A phone validator for Laravel using the free Twilio phone lookup service.
- Host: GitHub
- URL: https://github.com/stuyam/laravel-phone-validator
- Owner: stuyam
- License: mit
- Created: 2016-06-29T03:07:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-01T19:00:27.000Z (over 1 year ago)
- Last Synced: 2024-04-14T06:08:27.134Z (7 months ago)
- Topics: laravel, packagist, php, twilio
- Language: PHP
- Homepage: https://packagist.org/packages/stuyam/laravel-phone-validator
- Size: 23.4 KB
- Stars: 28
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
# Lavarel Phone Validator
[![Packagist](https://img.shields.io/packagist/v/stuyam/laravel-phone-validator.svg)](https://packagist.org/packages/stuyam/laravel-phone-validator)
[![Packagist](https://img.shields.io/packagist/dt/stuyam/laravel-phone-validator.svg)](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
Install via composer:```
composer require stuyam/laravel-phone-validator
```### Step 2
Add to your ```config/app.php``` service provider list:```php
StuYam\PhoneValidator\PhoneValidatorServiceProvider::class
```### 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
Add the string 'phone' to a form request rules or validator like so:```php
'required|phone'
];
}
}```