{"id":13394941,"url":"https://github.com/floere/phony","last_synced_at":"2025-05-12T15:24:30.202Z","repository":{"id":841378,"uuid":"564719","full_name":"floere/phony","owner":"floere","description":"E164 international phone number normalizing, splitting, formatting. ","archived":false,"fork":false,"pushed_at":"2025-03-22T10:49:58.000Z","size":6333,"stargazers_count":1052,"open_issues_count":1,"forks_count":232,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-10T08:04:30.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://florianhanke.com/phony/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"onedownfiveup/template-application","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floere.png","metadata":{"files":{"readme":"README.textile","changelog":"history.textile","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["floere"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2010-03-16T09:04:51.000Z","updated_at":"2025-05-02T21:43:58.000Z","dependencies_parsed_at":"2024-01-08T17:12:55.976Z","dependency_job_id":"b6689498-f15c-4a5f-8cb6-652fc3e4ea34","html_url":"https://github.com/floere/phony","commit_stats":{"total_commits":1353,"total_committers":183,"mean_commits":7.39344262295082,"dds":0.3584626755358463,"last_synced_commit":"4d2504bc0df431ac5d64fe452e4a0b0fce40619c"},"previous_names":[],"tags_count":296,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floere%2Fphony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floere%2Fphony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floere%2Fphony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floere%2Fphony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floere","download_url":"https://codeload.github.com/floere/phony/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253545458,"owners_count":21925400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:36.865Z","updated_at":"2025-05-12T15:24:30.150Z","avatar_url":"https://github.com/floere.png","language":"Ruby","readme":"\"!{float:right}https://secure.travis-ci.org/floere/phony.png!\":http://travis-ci.org/floere/phony\n!https://coveralls.io/repos/floere/phony/badge.svg?branch=master(Coverage Status)!:https://coveralls.io/r/floere/phony?branch=master\n\"!https://codeclimate.com/github/floere/phony.png!\":https://codeclimate.com/github/floere/phony\n!http://inch-ci.org/github/floere/phony.png!:http://inch-ci.org/github/floere/phony\n\nh1. Phony\n\nDisclaimer: Phony works with international numbers only, such as @61 412 345 678@!\n\nThe (admittedly crazy) goal of this Gem is to be able to normalize/format/split all phone numbers in the world.\n\nUsed in: \"airbnb.com\":http://airbnb.com, \"socialcam.com\":http://socialcam.com, \"zendesk.com\":http://www.zendesk.com/ (and many, many others).\n\nh2(#memory). Runtime Memory Usage\n\nAccording to \"memory_profiler\":https://github.com/SamSaffron/memory_profiler, the Phony gem uses roughly 1MB of memory per Ruby process.\nUsage was generated using (look for @Total retained@): @ruby -e 'require \"memory_profiler\"; MemoryProfiler.report(allow_files: \"phony\"){ require \"phony\" }.pretty_print'@\n\nh2. Description\n\nThis gem normalizes, formats and splits \"*E164 phone numbers*\":http://en.wikipedia.org/wiki/E.164. A valid E164 phone number *must* include a country code.\n\nE164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. For example, the Australian number @+61 412 345 678@ can be broken down into the following components:\n* Country Code (CC): a country code of @61@\n* National Destination Code (NDC): a mobile number denoted by the @4@ (specific to Australia)\n* Local Number Part: a subscriber number of @12 345 678@\n\nIt currently handles the countries listed at the end of this README.\n\nIt is covered by roughly 2,250 tests that run in 2 seconds (April 2019).\nIf it doesn't work, please \"enter an issue\":http://github.com/floere/phony/issues or better, fork and \"send a pull request\":http://github.com/floere/phony/pulls.\n\nh2. Installation\n\nWith Rails? Check out: https://github.com/joost/phony_rails.\n\nWith Bundler: Append @gem 'phony'@ to your @Gemfile@ and @bundle install@ it.\n\nWithout Bundler: Run @gem install phony@ from your command line.\n\nh2(#usage). Usage docs\n\nPhony uses \"qed\":https://github.com/rubyworks/qed as docs and to run its functional tests. Start here for usage docs: \"Usage index\":./qed/index.md.\n\nh3(#normalizing). Phony.normalize(number)\n\nNormalize intelligently removes all non-numeric characters of a number. Do it before storing a number in a DB.\n\n\"Phony.normalize docs\":./qed/normalize.md\n\n@Phony.normalize('1-888-407-4747').assert == '18884074747'@\n\nh3(#formatting). Phony.format(number, options = {})\n\nFormat formats a normalized number according to a country's predominant formatting. Lots of options for int'l, national, local formatting.\n\n\"Phony.format docs\":./qed/format.md\n\n@Phony.format('41443643532').assert == '+41 44 364 35 32'@\n\nh3(#plausibility). Phony.plausible?(number, options = {})\n\nIs a number plausible?\n\n\"Phony.plausible? docs\":./qed/plausibility.md\n\n@Phony.assert.plausible?('+41 44 111 22 33')@\n\nh3(#splitting). Phony.split(number)\n\nSplit a number into its parts: CC, NDC, local.\n\n\"Phony.split docs\":./qed/split.md\n\n@Phony.split('3928061371').assert == ['39', '2', '806', '1371']@\n\nNB If a country does not have an NDC, @#split@ will return @false@ in the NDC position, for example for Denmark:\n\n@Phony.split('4512121212').assert == ['45', false, '12', '12', '12', '12']@\n\nh3(#loading). Loading only a country subset (Phony 2.18.0+).\n\nUse this in case you'd like to save \"memory\":#memory that is used by Phony's CC rules.\n\n\"Phony::Config.load docs\":./qed/config.md\n\nFirst, @require 'phony/config'@.\nThen, one of the following, which will load the rest of Phony.\n\nLoad only these CCs:\n@Phony::Config.load(only: ['41', '44'])@\n\nLoads everything except these CCs:\n@Phony::Config.load(except: ['41', '44'])@\n\nConvenience form of @only@:\n@Phony::Config.load('41', '44')@\n\nEach of these loads the rest of Phony.\n\nMemory usage can be checked using (look for @Total retained@):\n@ruby -e 'require \"memory_profiler\"; MemoryProfiler.report(allow_files: \"phony\"){ require \"phony/config\"; Phony::Config.load(\"1\") }.pretty_print'@\nFor example, when just loading the NANP CC, the retained memory usage is ~63kB.\n\nh2. List of Handled Countries\n\nMildly unmaintained list: Abhas, Afghan, Algerian, Argentina, Austrian, Australian, Azerbaijani, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, El Salvadorian, Estonian, French, German, Ghanan, Gibraltar, Greek, Haiti, Hong Kong, Hungarian, Indian, Iran, Irish, Israel, Italian, Japanese, Kazakh, Liberian, Lithuanian, Luxembourgian, Malaysian, Malta, Mauritian, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Seychelles, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sri Lankan, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, Vietnamese, and Zambian numbers.\n\nh2. Proud Sponsors\n\n* Renuo AG (July 2022 – January 2025): \"Github\":https://github.com/renuo, \"Homepage\":https://www.renuo.ch. Much appreciated!\n\nh2. License\n\nMIT.\nSee \"LICENSE\":./LICENSE file.\n","funding_links":["https://github.com/sponsors/floere"],"categories":["Ruby","Uncategorized","Country Data"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloere%2Fphony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloere%2Fphony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloere%2Fphony/lists"}