{"id":15344645,"url":"https://github.com/ihabunek/ex_libphonenumber_js","last_synced_at":"2025-04-04T11:46:47.522Z","repository":{"id":145505330,"uuid":"466693839","full_name":"ihabunek/ex_libphonenumber_js","owner":"ihabunek","description":"Elixir wrapper for libphonenumber-js","archived":false,"fork":false,"pushed_at":"2022-03-09T06:57:03.000Z","size":174,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T21:43:10.317Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ihabunek.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-03-06T09:40:39.000Z","updated_at":"2022-03-08T08:25:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"483383ad-3d10-45d9-ae61-d2d813a86c41","html_url":"https://github.com/ihabunek/ex_libphonenumber_js","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"d510c02ee8a090100a164ca6cbe6f53c46c53e7b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihabunek%2Fex_libphonenumber_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihabunek%2Fex_libphonenumber_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihabunek%2Fex_libphonenumber_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihabunek%2Fex_libphonenumber_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihabunek","download_url":"https://codeload.github.com/ihabunek/ex_libphonenumber_js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174403,"owners_count":20896074,"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-10-01T11:01:49.524Z","updated_at":"2025-04-04T11:46:47.503Z","avatar_url":"https://github.com/ihabunek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibPhoneNumber\n\nProvides parsing and formatting phone numbers.\n\nAn Elixir wrapper around\n[libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js). Runs a\nsmall Node server which exposes a subset of libphonenumber-js functionality to\nElixir.\n\nRequires Node.\n\n**Motivation**: Makes it possible to use the same library for phone number\n  manipulation in server and client code, reducing the possiblity of different\n  behaviours between the two.\n\n**Status**: Under development. Anything can change.\n\n## Overview\n\n* [Source code](https://github.com/ihabunek/ex_libphonenumber_js/)\n* [Documentation](https://hexdocs.pm/parent/libphonenumber_js)\n* License: Apache License Version 2.0\n\n## Quick start\n\nStart the server before using.\n\n```elixir\niex\u003e LibPhoneNumber.start_link(nil)\n{:ok, #PID\u003c0.240.0\u003e}\n```\n\n### Parsing\n\nNational formatted numbers, requires a country code as second argument.\n\n```elixir\niex\u003e LibPhoneNumber.parse(\"(814) 300-8073\", \"US\")\n{:ok,\n %LibPhoneNumber.Parsed{\n   country: \"US\",\n   country_calling_code: \"1\",\n   national_number: \"8143008073\",\n   number: \"+18143008073\",\n   type: :fixed_line_or_mobile,\n   valid?: true\n }}\n```\n\nE164 formatted international numbers, does not require country code.\n\n```elixir\niex\u003e LibPhoneNumber.parse(\"+385991234567\")\n{:ok,\n %LibPhoneNumber.Parsed{\n   country: \"HR\",\n   country_calling_code: \"385\",\n   national_number: \"991234567\",\n   number: \"+385991234567\",\n   type: :mobile,\n   valid?: true\n }}\n```\n\nReturns an error if number cannot be parsed.\n\n```elixir\niex\u003e LibPhoneNumber.parse(\"0991\", \"HR\")\n{:error, :too_short}\n\niex\u003e LibPhoneNumber.parse(\"099123456789\", \"HR\")\n{:error, :too_long}\n\niex\u003e LibPhoneNumber.parse(\"banana\", \"HR\")\n{:error, :not_a_number}\n\niex(3)\u003e LibPhoneNumber.parse(\"123\", \"mango\")\n{:error, :invalid_country}\n```\n\n### Formatting numbers\n\n`format` takes an E.164 formatted phone number and formats it to one of the\nsupported format templates.\n\n```elixir\niex\u003e LibPhoneNumber.format(\"+18143008073\")\n{:ok, \"(814) 300-8073\"}\n\niex\u003e LibPhoneNumber.format(\"+18143008073\", :national)\n{:ok, \"(814) 300-8073\"}\n\niex\u003e LibPhoneNumber.format(\"+18143008073\", :international)\n{:ok, \"+1 814 300 8073\"}\n\niex\u003e LibPhoneNumber.format(\"+18143008073\", :e164)\n{:ok, \"+18143008073\"}\n\niex\u003e LibPhoneNumber.format(\"+18143008073\", :rfc3966)\n{:ok, \"tel:+18143008073\"}\n```\n\nReturns the same errors as `parse` with the addition of `:invalid_format`.\n\n```elixir\niex\u003e LibPhoneNumber.format(\"+18143008073\", :kiwi)\n{:error, :invalid_format}\n```\n\n## Upgrading to a newer version of libphonenumber-js\n\nNot required for normal usage, this is the procedure for creating a new release\nof LibPhoneNumber from a new version of the underlying javascript library.\n\nRequires [esbuild](https://esbuild.github.io/).\n\n```sh\n# Check for new versions\nnpm outdated\n\n# Upgrade javascript library to latest version\nnpm install libphonenumber-js@latest\n\n# Generate the javascript bundle\nmake bundle\n```\n\nCommit, tag, package, publish.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihabunek%2Fex_libphonenumber_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihabunek%2Fex_libphonenumber_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihabunek%2Fex_libphonenumber_js/lists"}