Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Phone numbers not formatting correctly #588

Closed
elarue opened this issue May 22, 2015 · 3 comments
Closed

Phone numbers not formatting correctly #588

elarue opened this issue May 22, 2015 · 3 comments

Comments

@elarue
Copy link

elarue commented May 22, 2015

According to the documentation in the README,

echo $faker->phoneNumber;

Is supposed to output a U.S. phone number. However, here is an example of a phone number I got using this command:

+30(9)4312207752

I also have had phone numbers with an area code or a prefix that starts with '1', which is not allowed in U.S. phone numbers.

@fzaninotto
Copy link
Owner

Here is the list of phone number patterns for the US locale:

  • +##(#)##########
  • +##(#)##########
  • 0##########
  • 0##########
  • ###-###-####
  • (###)###-####
  • 1-###-###-####
  • ###.###.####
  • ###-###-####
  • (###)###-####
  • 1-###-###-####
  • ###.###.####
  • ###-###-####x###
  • (###)###-####x###
  • 1-###-###-####x###
  • ###.###.####x###
  • ###-###-####x####
  • (###)###-####x####
  • 1-###-###-####x####
  • ###.###.####x####
  • ###-###-####x#####
  • (###)###-####x#####
  • 1-###-###-####x#####
  • ###.###.####x####

The phone number you got corresponds to the first pattern ; I see patterns starting with 1, too.

If you know which are allowed and which are not, would you mind tweaking this list and sending me a PR on the US PhoneNumber provider?

@bmitch
Copy link

bmitch commented Jun 20, 2015

I believe phone numbers starting with a 1 are valid in the US (like 1-800 numbers).

@okj579
Copy link
Contributor

okj579 commented Jun 20, 2015

1 as a prefix is fine, however the area code and exchange code are not allowed to start with 0 or 1. Pull request coming later today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants