Validate that a phone number is in the correct format
289,545
68
6
Package Data
Maintainer Username: ssx
Maintainer Contact: tylercd100@gmail.com (Tyler Arbon)
Package Create Date: 2017-09-10
Package Last Update: 2024-04-16
Home Page: https://laravel-validation-rules.github.io/
Language: PHP
License: Apache-2.0
Last Refreshed: 2024-12-13 15:00:27
Package Statistics
Total Downloads: 289,545
Monthly Downloads: 5,570
Daily Downloads: 154
Total Stars: 68
Total Watchers: 6
Total Forks: 12
Total Open Issues: 1

Phone

Validates phone number format.

Installation

composer require laravel-validation-rules/phone

Usage

use LVR\Phone\Phone;
use LVR\Phone\E123;
use LVR\Phone\E164;
use LVR\Phone\NANP;
use LVR\Phone\Digits;

// Test any phone number
$request->validate(['test' => '15556667777'], ['test' => new Phone]); // Pass!
$request->validate(['test' => '+15556667777'], ['test' => new Phone]); // Pass!
$request->validate(['test' => '+1 (555) 666-7777'], ['test' => new Phone]); // Pass!

// Test for E123
$request->validate(['test' => '+22 555 666 7777'], ['test' => new E123]); // Pass!

// Test for E164
$request->validate(['test' => '+15556667777'], ['test' => new E164]); // Pass!

// Test for NANP (North American Numbering Plan)
$request->validate(['test' => '+1 (555) 666-7777'], ['test' => new NANP); // Pass!

// Test for digits only
$request->validate(['test' => '15556667777'], ['test' => new Digits]); // Pass!