Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone validator #24

Closed
samdark opened this issue Jul 25, 2019 · 4 comments
Closed

Phone validator #24

samdark opened this issue Jul 25, 2019 · 4 comments
Labels
type:enhancement Enhancement

Comments

@samdark
Copy link
Member

samdark commented Jul 25, 2019

Would be good to have international phone validator.

Input: +7 454 545-44-44, +74545454444, +7 (454)545-4444

Algorithm:

  1. Check if phone starts with +.
  2. Take rest of the string, remove space, -, (, ). Check if string is numeric.
@samdark samdark added the type:enhancement Enhancement label Jul 25, 2019
@machour
Copy link
Member

machour commented Jul 26, 2019

+ can be substituted by 00 (0033612345678 and +33612345678 are the same phone number)

@samdark
Copy link
Member Author

samdark commented Jul 28, 2019

Nope. That's country-specific.

@SilverFire
Copy link
Member

As far as I know, libphonenumber by Google is the most correct phone validator implementation. There is a PHP port libphonenumber-for-php so I'd prefer using it.

@samdark
Copy link
Member Author

samdark commented Dec 26, 2019

Seems to be out of scope of general validation library.

@samdark samdark closed this as completed Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants