2017 © Pedro Peláez
 

library laravel-phone-validator

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

image

stuyam/laravel-phone-validator

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

  • Wednesday, October 25, 2017
  • by stuyam
  • Repository
  • 1 Watchers
  • 4 Stars
  • 1,627 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 7 Versions
  • 17 % Grown

The README.md

Lavarel Phone Validator

Packagist Packagist, (*1)

A phone validator for Laravel using the FREE Twilio phone lookup service, (*2)

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., (*3)

For a working example check out Laravel Validator Example project., (*4)

Also see: Laravel Kickbox Validator for email address validation., (*5)

Step 1

Install via composer:, (*6)

composer require stuyam/laravel-phone-validator

Step 2

Add to your config/app.php service provider list:, (*7)

StuYam\PhoneValidator\PhoneValidatorServiceProvider::class

Step 3

Add Twilio credentials to your .env file:, (*8)

(If you don't have a Twilio account you can go to Twilio.com and make a free account), (*9)

TWILIO_SID=xxxxxxxx
TWILIO_TOKEN=xxxxxxxx

Usage

Add the string 'phone' to a form request rules or validator like so:, (*10)

<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class PhoneFormRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            // this means the phone input will be validated that
            // it is required and that it is an ACTUAL phone number
            'phone' => 'required|phone'
        ];
    }
}

The Versions

25/10 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

25/10 2017

1.0.5

1.0.5.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

13/10 2017

1.0.4

1.0.4.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

11/09 2017

v1.0.3

1.0.3.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

07/09 2017

v1.0.2

1.0.2.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

10/08 2017

1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone

13/07 2016

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

by Stuart Yamartino

laravel validator validation twilio phone