PicoPhone: a fast native wrapper around libphonenumber
I just published pico_phone (source), a thin Ruby wrapper around Google’s libphonenumber C++ library via Rice. It’s the same engine Android’s dialer uses, so you get accurate parsing, validation, and formatting for phone numbers from any country: national/international/E.164 formats, area code and local number extraction, type detection (mobile, toll-free, etc.), vanity number conversion, short-number/emergency-number lookups, and more.
It all runs as compiled C++ instead of a pure-Ruby regex port, which matters if you’re validating numbers at any real volume. Pre-compiled native gems are available for arm64-darwin, x86_64-linux,
and aarch64-linux, so most people can gem install pico_phone with no compiler or system libraries required. Feedback and issues welcome on GitHub.
Post a comment