{"id":19210895,"url":"https://github.com/mathieuprog/mobile_number_format","last_synced_at":"2025-08-31T05:35:20.738Z","repository":{"id":45779019,"uuid":"367387815","full_name":"mathieuprog/mobile_number_format","owner":"mathieuprog","description":"Parse and validate mobile phone numbers","archived":false,"fork":false,"pushed_at":"2023-05-08T10:05:49.000Z","size":181,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T17:37:48.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathieuprog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2021-05-14T14:28:01.000Z","updated_at":"2023-05-08T14:26:40.000Z","dependencies_parsed_at":"2024-11-09T13:39:55.991Z","dependency_job_id":null,"html_url":"https://github.com/mathieuprog/mobile_number_format","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"33fe30d2817446237a9b7110d555b32dfdf5b6bd"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieuprog%2Fmobile_number_format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieuprog%2Fmobile_number_format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieuprog%2Fmobile_number_format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieuprog%2Fmobile_number_format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathieuprog","download_url":"https://codeload.github.com/mathieuprog/mobile_number_format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253807654,"owners_count":21967397,"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-11-09T13:39:39.130Z","updated_at":"2025-05-12T19:27:48.337Z","avatar_url":"https://github.com/mathieuprog.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MobileNumberFormat\n\nThis library helps you parsing and validating mobile phone numbers.\n\nIt relies on the data available in Google's [libphonenumber](https://github.com/google/libphonenumber) library. Version `0.4.0` uses the data from version `v8.13.11` of `libphonenumber`.\n\n### `parse/1`\n\n```elixir\nassert {:ok,\n  %{\n    country_code: \"BE\",\n    country_calling_code: \"32\",\n    national_number: \"455123456\",\n    trimmed_national_number_input: \"455/12.34.56\"\n  }} =\n    MobileNumberFormat.parse(%{\n      country_calling_code: 32,\n      national_number: \"0455/12.34.56\"\n    })\n```\n\nThe `parse/1` function receives a map that may contain any of these keys:\n* `country_code`\n  For instance `\"BE\"`.\n\n* `country_calling_code`\n  For instance `\"32\"`, `\"+32\"` or `32`.\n  Local international call prefixes are not supported (only the prefix `+` is supported).\n\n* `national_number`\n  For instance the Belgian national number `\"455/12.34.56\"`. National prefixes are supported `\"0455/12.34.56\"`.\n\n* `international_number`\n  For instance `\"+32 455/12.34.56\"`. A national prefix may be added in parentheses `\"+32 (0)455/12.34.56\"`.\n\nIn case the number is valid, the tuple `{:ok, data}` is returned where `data` is a map containing the 4 key/values mentioned above.\n\nIn case of error, the following atoms may be returned:\n\n* `:invalid_country_code`\n* `:invalid_country_calling_code`\n* `:invalid_number`\n* `:insufficient_data`\n\n### `valid_number?/1`\n\nSame as `parse/1` but returns `true` or `false` whether the number is valid or not.\n\n### `valid_country_calling_code?/1`\n\nChecks whether the given country calling code is valid or not.\n\n### `valid_country_code?/1`\n\nChecks whether the given ISO country code is valid or not.\n\n### `formatting_data_per_territory/0`\n\nReturns a list of all the formatting rules. Example of formatting rules (for Belgium):\n\n```elixir\n%{\n  country_calling_code: \"32\",\n  example: \"470123456\",\n  country_code: \"BE\",\n  national_prefix: \"0\",\n  possible_lengths: [9],\n  regex: ~r/4[5-9]\\d{7}/\n}\n```\n\n## Ecto schema\n\nThe library provides an embedded schema `MobileNumberFormat.MobileNumber`.\n\n## Installation\n\nAdd `mobile_number_format` for Elixir as a dependency in your `mix.exs` file:\n\n```elixir\ndef deps do\n  [\n    {:mobile_number_format, \"~\u003e 0.4.0\"}\n  ]\nend\n```\n\n## HexDocs\n\nHexDocs documentation can be found at [https://hexdocs.pm/mobile_number_format](https://hexdocs.pm/mobile_number_format).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieuprog%2Fmobile_number_format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathieuprog%2Fmobile_number_format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieuprog%2Fmobile_number_format/lists"}