Faker icon indicating copy to clipboard operation
Faker copied to clipboard

Feature: phoneNumber without extension (en_US)

Open MGatner opened this issue 5 years ago • 2 comments

After running into this with the second major identity provider (Stripe first, now Google Firebase) I believe and option for a US phone number that never includes an extension is in order. Both of these providers occasionally reject phone numbers generated by Faker\Provider\en_US\PhoneNumber because of the length of inclusion of the "x".

MGatner avatar Jan 27 '20 15:01 MGatner

I do not think that this should be fakers job, But you can use libphonenumber to fix it in your code

mikk150 avatar Feb 19 '20 13:02 mikk150

That works but adds an entire validation library. It may or may not be Faker's job but the phoneNumber provider is already pretty sparse so it doesn't seem like a bad addition. Other providers break the components of the data into parts, e.g.: streetName, streetSuffix, streetAddress so you can fake the portion(s) needed for a particular scenario. This would essentially be the same thing for phone numbers, especially considering that extensions are non-standard.

MGatner avatar Feb 19 '20 16:02 MGatner