2

I need a library to help with parsing international phone number. I tried a couple of them like phone_number, phone, phony, and phoney. After playing with them the whole afternoon, none of them is perfect or as good as Google's libphonenumber (Java though). However, I am forced to choose one for my current project so I go with phoney gem, which seems active and provides more international support. Does anyone know anything better?

There was a similar question below but it's more than a year ago and focused on US phone numbers.

Is there a gem that normalizes and format US phone numbers in ruby?

Community
  • 1
  • 1
Daniel Tsai
  • 39
  • 1
  • 3

3 Answers3

2

Check out Phoner. It seems to parse both US and international numbers well.

Winfield
  • 18,985
  • 3
  • 52
  • 65
  • Check out rules in phoner https://github.com/carr/phone/blob/master/data/phone_countries.yml and rules in phoney https://github.com/habermann24/phoney/blob/master/lib/data/regions.yml. The latter provides more details. – Daniel Tsai Sep 21 '12 at 02:47
1

The most current and supported (as for now) is https://github.com/floere/phony

Also you can have a look on https://github.com/carr/phone and https://github.com/habermann24/phoney/

Aldekein
  • 3,538
  • 2
  • 29
  • 33
0

I wrote a gem called ItuCodes that does basic parsing of country codes, paying special attention to complex cases like North America, Russia & Kazakhstan: * https://github.com/bowsersenior/itu_codes

ItuCodes does not aim to fully parse area codes for every country code, but such a tool could be built on top of it.

bowsersenior
  • 12,524
  • 2
  • 46
  • 52