PHP code example of laravel-validation-rules / phone
1. Go to this page and download the library: Download laravel-validation-rules/phone library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laravel-validation-rules / phone example snippets
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!
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.