A Ruby gem for normalizing, formatting, and splitting E164 international phone numbers.
Phony is a Ruby gem designed for processing E164 international phone numbers. It provides functionality to normalize, format, split, and validate phone numbers from numerous countries, ensuring they adhere to international standards. It solves the problem of inconsistent phone number formats in global applications by offering a reliable, tested library.
Ruby developers building applications that require handling international phone numbers, such as e-commerce platforms, customer relationship management systems, or any service with global user bases.
Developers choose Phony for its comprehensive country support, robust test coverage, and memory-efficient design. Its ability to selectively load country rules and its proven use in high-traffic sites like Airbnb and Zendesk make it a trusted, performant solution.
E164 international phone number normalizing, splitting, formatting.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Intelligently strips all non-numeric characters for clean database storage, as demonstrated with examples like normalizing '1-888-407-4747' to '18884074747'.
Supports country-specific patterns for international, national, and local formats, with detailed options shown in the formatting documentation.
Allows selective loading of country rules to reduce memory usage, cutting it down to ~63kB for specific codes like NANP, as per memory profiling examples.
Used by high-traffic sites like Airbnb and Zendesk, and backed by over 2,250 tests that run quickly, ensuring stability.
Only handles international numbers with country codes, making it unsuitable for local or national formats without adaptations.
The README admits the country list is 'mildly unmaintained,' risking outdated or incomplete rules for some regions.
Plausibility checks are structural only, lacking deeper validation like carrier existence or real-time verification, which some applications may need.