All Projects → adrianbj → Fieldtypephone

adrianbj / Fieldtypephone

Licence: gpl-2.0
ProcessWire Fieldtype for entering 4 part phone numbers: country/area code/number/extension as integers

Projects that are alternatives of or similar to Fieldtypephone

haoma
手机固话电话号码标记批量查询📞📌
Stars: ✭ 52 (+940%)
Mutual labels:  phone-number
Libphonenumber Csharp
Offical C# port of https://github.com/googlei18n/libphonenumber
Stars: ✭ 396 (+7820%)
Mutual labels:  phone-number
Chinamobilephonenumberregex
Regular expressions that match the mobile phone number in mainland China. / 一组匹配中国大陆手机号码的正则表达式。
Stars: ✭ 4,440 (+88700%)
Mutual labels:  phone-number
react-native-phone-number-input
React Native component for phone number.
Stars: ✭ 206 (+4020%)
Mutual labels:  phone-number
Awesome Phonenumber
Google's libphonenumber pre-compiled with the closure compiler
Stars: ✭ 357 (+7040%)
Mutual labels:  phone-number
Edittext Mask
The custom masks for EditText. The solution for input phone numbers, SSN, and so on for Android
Stars: ✭ 413 (+8160%)
Mutual labels:  phone-number
CHRTextFieldFormatter
Provides UITextField formatting masks. Such as phone number and credit card number formatters.
Stars: ✭ 52 (+940%)
Mutual labels:  phone-number
Phonelib
Ruby gem for phone validation and formatting using google libphonenumber library data
Stars: ✭ 731 (+14520%)
Mutual labels:  phone-number
Libphonenumber For Php
PHP version of Google's phone number handling library
Stars: ✭ 3,938 (+78660%)
Mutual labels:  phone-number
Phonenumberkit
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.
Stars: ✭ 4,362 (+87140%)
Mutual labels:  phone-number
Countrycodepicker
Country Code Picker (CCP) is an android library which provides an easy way to search and select country phone code ( national code ) for the telephone number.
Stars: ✭ 259 (+5080%)
Mutual labels:  phone-number
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (+5820%)
Mutual labels:  phone-number
Phoneinfoga
PhoneInfoga is one of the most advanced tools to scan international phone numbers using only free resources. It allows you to first gather standard information such as country, area, carrier and line type on any international phone number. Then search for footprints on search engines to try to find the VoIP provider or identify the owner.
Stars: ✭ 5,927 (+118440%)
Mutual labels:  phone-number
ember-phone-input
An Ember.js component to handle international phone numbers
Stars: ✭ 22 (+340%)
Mutual labels:  phone-number
Phone
With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.
Stars: ✭ 531 (+10520%)
Mutual labels:  phone-number
intl-tel-input-rails
intl-tel-input for the Rails asset pipeline
Stars: ✭ 35 (+600%)
Mutual labels:  phone-number
Vue Phone Number Input
A phone number input made with Vue JS (format & valid phone number)
Stars: ✭ 407 (+8040%)
Mutual labels:  phone-number
Crboxinputview
Verify code input view. Support security type for password.短信验证码输入框,支持密文模式
Stars: ✭ 749 (+14880%)
Mutual labels:  phone-number
Intl Tel Input
A JavaScript plugin for entering and validating international telephone numbers
Stars: ✭ 5,963 (+119160%)
Mutual labels:  phone-number
Dial2verify Twilio
Phone verification at no cost
Stars: ✭ 432 (+8540%)
Mutual labels:  phone-number

Phone Number Fieldtype

A 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.

StyledOutput

The most common usage option will be:

echo $page->fieldname //eg. +1 (123) 456-7890 x123

This 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.

This is a shortcut that produces the same output as:

echo $page->fieldname->formattedNumber //eg. +1 (123) 456-7890 x123

Alternate styled options are:

echo $page->fieldname->formattedNumberNoExt: //eg. +1 (123) 456-7890
echo $page->fieldname->formattedNumberNoCtry: //eg. (123) 456-7890 x123
echo $page->fieldname->formattedNumberNoCtryNoExt: //eg. (123) 456-7890

echo $page->fieldname->unformattedNumber: //eg. 11234567890123
echo $page->fieldname->unformattedNumberNoExt: //eg. 11234567890
echo $page->fieldname->unformattedNumberNoCtry: //eg. 1234567890123
echo $page->fieldname->unformattedNumberNoCtryNoExt: //eg. 1234567890

Of course the actual output is determined by the selected format output.

You can also call any of the defined formats manually like this:

echo $page->fieldname->australiaWithCountryAreaCodeNoLeadingZero;

Raw Output

You can output the values for the component parts of the phone number like this:

echo $page->fieldname->country;
echo $page->fieldname->area_code;
echo $page->fieldname->number;
echo $page->fieldname->extension;

Output for mobile compatibility

To get iOS and other mobile platforms to recognize numbers and be able to automatically dial them, use something like this:

echo '<a href="tel:+'.$page->fieldname->unformattedNumberNoExt.'">'.$page->fieldname->formattedNumber.'</a>';

Selectors for searching

The component parts can be used in selectors like this:

$pages->find("phone.area_code=123");

Field Settings

There is a field settings for the width of each number component in pixels.

You can also choose whether to display the country and extension fields for input. Off by default.

There 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.

Custom formatting options

On 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.

australiaWithCountryAreaCodeNoLeadingZero | {+[phoneCountry]} {([phoneAreaCode])} {[phoneNumber,0,3]}-{[phoneNumber,3,4]} {x[phoneExtension]} | 61,07,12345678,123

Note: 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: +1 (7) 1234 5678 x123 even though the full "07" is stored in the area code field.

Component Notes

Each component is surrounded by { }

The names of the component parts are surrounded by [ ]

Two optional comma separated numbers after the component name are used to get certain parts of the number using PHP's substr function, allowing for complete flexibility.

Anything outside the [ ] or { } is used directly: +,-,(,),x, spaces, etc - whatever every you want to use.

Setup

  • 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.
  • Create a new Field with the new "Phone" Fieldtype.

Support

http://processwire.com/talk/topic/4388-phone-number-fieldtype/

To Do

Need 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.

Acknowledgments

This module uses code from Soma's DimensionFieldtype and the core FieldtypeDatetime module - thanks guys for making it so easy.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

(See included LICENSE file for full license text.)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].