Validate a phone number
Using Laravel's powerful validation feature.
- PHP >= 7.1
- Laravel >= 5.5 or 6.0
Install the package via the Composer package manager:
$ composer require soved/laravel-phone-number-validation
You may use the phone number validation as any other validation rule:
<?php $request->validate([ 'phone_number' => 'required|string|phone_number', ]);
If needed, you may customize the validation error message by adding an entry to the validation language file:
'phone_number' => 'The phone number format is invalid.', 'accepted' => 'The :attribute must be accepted.', // The rest of the validation error messages...
If you discover a security vulnerability within this project, please send an e-mail to Sander de Vos via email@example.com. All security vulnerabilities will be promptly addressed.
This package is open-source software licensed under the MIT license.