Skip to content

Instantly share code, notes, and snippets.

@tomshaw
Created April 7, 2021 20:33
Show Gist options
  • Save tomshaw/5ea727b1f29ee64ec79352758822607c to your computer and use it in GitHub Desktop.
Save tomshaw/5ea727b1f29ee64ec79352758822607c to your computer and use it in GitHub Desktop.
Laravel telephone number validators.
$this->validate($request, [
'phone' => 'required|digits:10'
]);
$this->validate($request, [
'phone' => 'required|numeric|between:9,11'
]);
$this->validate($request, [
'phone' => 'required|min:10|numeric'
]);
$this->validate($request, [
'phone' => 'required|regex:/(01)[0-9]{9}/'
]);
$this->validate($request, [
'phone' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:10'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment