{"id":19348822,"url":"https://github.com/adrianbj/fieldtypephone","last_synced_at":"2025-04-23T06:30:41.277Z","repository":{"id":10357624,"uuid":"12496691","full_name":"adrianbj/FieldtypePhone","owner":"adrianbj","description":"ProcessWire Fieldtype for entering 4 part phone numbers: country/area code/number/extension as integers","archived":false,"fork":false,"pushed_at":"2024-05-13T21:28:56.000Z","size":115,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T09:22:14.943Z","etag":null,"topics":["fieldtype","phone-number","processwire"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianbj.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":"2013-08-30T22:24:31.000Z","updated_at":"2024-05-13T21:28:44.000Z","dependencies_parsed_at":"2023-01-11T19:45:46.943Z","dependency_job_id":"d31e3c4f-a3bf-4961-a239-fdc6eaaa19a5","html_url":"https://github.com/adrianbj/FieldtypePhone","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbj%2FFieldtypePhone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbj%2FFieldtypePhone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbj%2FFieldtypePhone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbj%2FFieldtypePhone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianbj","download_url":"https://codeload.github.com/adrianbj/FieldtypePhone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250384641,"owners_count":21421762,"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":["fieldtype","phone-number","processwire"],"created_at":"2024-11-10T04:23:13.529Z","updated_at":"2025-04-23T06:30:40.922Z","avatar_url":"https://github.com/adrianbj.png","language":"PHP","readme":"# Phone Number Fieldtype\n\nA ProcessWire fieldtype to enter phone numbers with 4 integer values for country, area code, number and extension and format the output based on predefined or custom options.\n\n## StyledOutput\n\nThe most common usage option will be:\n```\necho $page-\u003efieldname //eg. +1 (123) 456-7890 x123\n```\nThis provides a fully formatted phone number, based on the output format chosen from module's configuration page, or with the format override option (if enabled), when entering a phone number on a page.\n\nThis is a shortcut that produces the same output as:\n```\necho $page-\u003efieldname-\u003eformattedNumber //eg. +1 (123) 456-7890 x123\n```\n\nAlternate styled options are:\n\n```\necho $page-\u003efieldname-\u003eformattedNumberNoExt: //eg. +1 (123) 456-7890\necho $page-\u003efieldname-\u003eformattedNumberNoCtry: //eg. (123) 456-7890 x123\necho $page-\u003efieldname-\u003eformattedNumberNoCtryNoExt: //eg. (123) 456-7890\n\necho $page-\u003efieldname-\u003eunformattedNumber: //eg. 11234567890123\necho $page-\u003efieldname-\u003eunformattedNumberNoExt: //eg. 11234567890\necho $page-\u003efieldname-\u003eunformattedNumberNoCtry: //eg. 1234567890123\necho $page-\u003efieldname-\u003eunformattedNumberNoCtryNoExt: //eg. 1234567890\n```\n\nOf course the actual output is determined by the selected format output.\n\nYou can also call any of the defined formats manually like this:\n\n```\necho $page-\u003efieldname-\u003eaustraliaWithCountryAreaCodeNoLeadingZero;\n```\n\n\n## Raw Output\n\nYou can output the values for the component parts of the phone number like this:\n\n```\necho $page-\u003efieldname-\u003ecountry;\necho $page-\u003efieldname-\u003earea_code;\necho $page-\u003efieldname-\u003enumber;\necho $page-\u003efieldname-\u003eextension;\n```\n\n## Output for mobile compatibility\n\nTo get iOS and other mobile platforms to recognize numbers and be able to automatically dial them, use something like this:\n```\necho '\u003ca href=\"tel:+'.$page-\u003efieldname-\u003eunformattedNumberNoExt.'\"\u003e'.$page-\u003efieldname-\u003eformattedNumber.'\u003c/a\u003e';\n```\n\n## Selectors for searching\n\nThe component parts can be used in selectors like this:\n```\n$pages-\u003efind(\"phone.area_code=123\");\n```\n\n## Field Settings\n\nThere is a field settings for the width of each number component in pixels.\n\nYou can also choose whether to display the country and extension fields for input. Off by default.\n\nThere is an additional checkbox that determines whether there is an option to override the default format option on a per entry basis, which will be useful when styling phone numbers from different countries on the one website. Off by default.\n\n\n## Custom formatting options\n\nOn the module's configuration page you can choose from predefined formats, or create custom formats using syntax like this with one format per line: `name | format | example numbers` eg.\n```\naustraliaWithCountryAreaCodeNoLeadingZero | {+[phoneCountry]} {([phoneAreaCode])} {[phoneNumber,0,3]}-{[phoneNumber,3,4]} {x[phoneExtension]} | 61,07,12345678,123\n```\n\nNote: when dialing from within Australia, area codes start with a 0, but when dialing from another country, the 0 must be omitted. The example format above handles this by truncating the first number from an Australian two digit area code which generates: \n`+1 (7) 1234 5678 x123` even though the full \"07\" is stored in the area code field.\n\n\n**Component Notes**\n\nEach component is surrounded by { }\n\nThe names of the component parts are surrounded by [ ]\n\nTwo optional comma separated numbers after the component name are used to get certain parts of the number using [PHP's substr function](http://php.net/manual/function.substr.php), allowing for complete flexibility.\n\nAnything outside the [ ] or { } is used directly: +,-,(,),x, spaces, etc - whatever every you want to use.\n\n\n## Setup\n\n* Choose a Phone Output Format from the module's configuration page. You can also set the numbers that will be used in the formatted example which may be helpful in certain regions to give a more realistic example.\n* Create a new Field with the new \"Phone\" Fieldtype.\n\n\n## Support\n\nhttp://processwire.com/talk/topic/4388-phone-number-fieldtype/\n\n\n## To Do\n\nNeed to increase the number of pre-defined formats. There seem to be so many options and no real standards, so I thought rather than create a huge list of options that no-one will use, I thought I'd wait and get you guys to contribute them as you need them. Either post your formats here, or send me a PR on github and I'll add them.\n\n\n## Acknowledgments\n\nThis module uses code from Soma's DimensionFieldtype and the core FieldtypeDatetime module - thanks guys for making it so easy.\n\n\n## License\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n(See included LICENSE file for full license text.)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbj%2Ffieldtypephone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianbj%2Ffieldtypephone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbj%2Ffieldtypephone/lists"}