Laravel phone number validation

2024-03-04 04:19:33 Andrew Laravel

How to validate phone number in Laravel Framework?

Laravel did not provide any inbuilt validation method for validating phone no. The only way to validate phone no in laravel is through regex.

Laravel phone validation Example

'phone' => 'required|regex:/(01)[0-9]{9}/'

The above regex will check the submitted input starts with 01 and is followed by 9 numbers.

This post is submitted by one of our members. You may submit a new post here.

Related Tricks