antonioribeiro / countries

Laravel countries and currencies
BSD 3-Clause "New" or "Revised" License
1.83k stars 281 forks source link

Phone number #5

Open spham opened 7 years ago

spham commented 7 years ago

Hi Can you include Phone format in E164 as feature ?

antonioribeiro commented 7 years ago

Yeah, would love to, but won't be able to until march 20, feel free to send a PR.

olivernybroe commented 7 years ago

@spham could you give an example on how you would like the data? Already making a pull request so shouldn't be a problem to add your request too.

The calling code is already included, so if I understand E164 correctly you just want to add a + before the calling code?

spham commented 7 years ago

something like this. https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region

olivernybroe commented 7 years ago

@spham The only difference I see on this and the already included property callingCode is there is an + before. Is that correct?

spham commented 7 years ago

The recommandation are here, and seems a lots of complex than + https://en.wikipedia.org/wiki/E.164

olivernybroe commented 7 years ago

My bad, I can see there is also a National Destination Code which is optional. Will try to see if I can find a dataset with the needed data.

antonioribeiro commented 7 years ago

@uruloke, did you found something?

antonioribeiro commented 7 years ago

National Destination Code, looks a lot like the telephone number. An example here in my country:

International calling phone number = +5521980882233

+55 = Country Code (Brazil) 21980882233 = National Destination Code

21 = City Code (Rio de Janeiro) 980882233 = Local Phone Number

Local phone numbers can repeat on another city:

11 = City Code (São Paulo) 980882233 = Local Phone Number

That being said, take a look at those two datasets, please:

http://country.io/phone.json https://github.com/datasets/country-codes/blob/master/data/country-codes.csv

In this last one I found some other data we are missing, like Geoname ID and EDGAR.

olivernybroe commented 7 years ago

@antonioribeiro http://country.io/phone.json This one seems a little inconsistence on when it wan't to use + at th beginning and when not to. The last one looks a lot more clean and the data is at least correct for my country.

olivernybroe commented 7 years ago

@antonioribeiro my thoughts were more to integrate something like libphonenumber by google https://github.com/googlei18n/libphonenumber. There is an PHP port from giggsey https://github.com/giggsey/libphonenumber-for-php, and also an Laravel port of giggseys port https://github.com/Propaganistas/Laravel-Phone.

I haven't done anything yet to implement it, as I couldn't figure out how you loaded the data.

spham commented 7 years ago

i think about new, issue

how to store in database ?

field (prefix, phone ) or field (phone e164 , i.e +337xxxxxxx )

iBeriaLab commented 7 years ago

country calling code display with [""] ["297"] ["93"] ["244"] ["1264"] ["358"] ["355"] ["376"] ["971"] ["54"] ["374"] ["1684"]......

please help me. how to remove [""] tag?