Skip to content

Commit

Permalink
Updated readme for the PHONE validator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stuyam committed Jul 13, 2016
1 parent fb02d2a commit dc341cd
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#Lavarel Twilio Validator
A [twilio phone lookup](https://www.twilio.com/lookup) validator for form requests in laravel.
This custom validator for Laravel uses the FREE [Twilio](https://www.twilio.com/lookup) API to validate 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.
#Lavarel 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.

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-twilio-validator
composer require stuyam/laravel-phone-validator
```

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

```php
StuYam\TwilioValidator\TwilioValidatorServiceProvider::class
StuYam\PhoneValidator\PhoneValidatorServiceProvider::class
```

###Step 3
Expand All @@ -25,10 +26,11 @@ Add Twilio credentials to your .env file:
TWILIO_SID=xxxxxxxx
TWILIO_TOKEN=xxxxxxxx
```
(If you don't have a Twilio account you can go to [Twilio.com](https://www.twilio.com/) and make a free account)


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

```php
<?php
Expand Down Expand Up @@ -57,7 +59,9 @@ class PhoneFormRequest extends Request
public function rules()
{
return [
'phone' => 'required|twilio'
// this means the phone input will be validated that
// it is required and that it is an ACTUAL phone number
'phone' => 'required|phone'
];
}
}
Expand Down

0 comments on commit dc341cd

Please sign in to comment.