Validate that a phone number is in the correct format
Installs: 289 279
Dependents: 0
Suggesters: 0
Security: 0
Stars: 68
Watchers: 6
Forks: 12
Open Issues: 1
Requires
- php: ^7.0|^8.0
- illuminate/contracts: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^3.5|^5.0|^7.0|^9.0
- phpunit/phpunit: ^6.3|^9.0|^10.5
README
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!