PHP code example of tylercd100 / laravel-validator-phone

1. Go to this page and download the library: Download tylercd100/laravel-validator-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/ */

    

tylercd100 / laravel-validator-phone example snippets


Tylercd100\Validator\Phone\ServiceProvider::class

// Test any phone number
Validator::make(['test' => '15556667777'], ['test' => 'phone']); //true
Validator::make(['test' => '+15556667777'], ['test' => 'phone']); //true
Validator::make(['test' => '+1 (555) 666-7777'], ['test' => 'phone']); //true

// Test for E164
Validator::make(['test' => '+15556667777'], ['test' => 'phone:E164']); //true

// Test for NANP (North American Numbering Plan)
Validator::make(['test' => '+1 (555) 666-7777'], ['test' => 'phone:NANP']); //true

// Test for digits only
Validator::make(['test' => '15556667777'], ['test' => 'phone:digits']); //true