Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lalitesh's avatar

Mobile/ Phone number validation

Is it possible to extend the L5 validation method to validate the mobile/ phone number?

0 likes
8 replies
lalitesh's avatar

Thanks, did not think about it! Let me try

Mahaveer's avatar
'phone_number' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:10',
1 like
martinbean's avatar

@lalitesh You can use a service like Nexmo or Twilio if you need to properly validate phone numbers.

martinbean's avatar

@shubham_kashyap Ignoring the fact you’ve replied to a topic whose last post was six months ago, your suggestion will not work for example, for phone numbers here in the UK that all start with a 0.

If you’re going to reply to an old conversion, at least provide a well-researched and usable answer.

4 likes

Please or to participate in this conversation.