Jump to content

Recommended Posts

Posted

Hi everyone,

Building a package forwarding platform means dealing with phone numbers from dozens of countries. US customers, European recipients, warehouse staff - each expects a different format. Storing a raw string and hoping for the best doesn't work. This fieldtype does it properly.

https://camo.githubusercontent.com/a9d37cfc05249d33c89df6a8a9acf4ace252e8502246f734ea63708557ce5258/68747470733a2f2f7261772e6769746875622e636f6d2f6a61636b6f636e722f696e746c2d74656c2d696e7075742f6d61737465722f73637265656e73686f74732f6974692d6769746875622d6461726b2e706e67

GitHub: https://github.com/mxmsmnv/FieldtypeTel

What it does

Powered by intl-tel-input v28 - bundled locally, no CDN dependency.

  • Country flag picker with search
  • Stores four formats per number:
    • e164 - +12025550123 - for tel: links and shipping APIs
    • intl - +1 202-555-0123 - for international display
    • national - (202) 555-0123 - for local display
    • country - us - for filtering and selectors
echo $page->phone;              // (202) 555-0123
echo $page->phone->e164;        // +12025550123
echo $page->phone->country;     // us

// tel: link
echo "<a href='tel:{$page->phone->e164}'>{$page->phone}</a>";

// Selector — find all Australian numbers
$pages->find("phone.country=au");
 
  • Restrict countries, set preferred countries, per-field defaults
  • Auto-format as user types
  • AdminThemeUikit themed - light and dark mode via --pw-* CSS variables

Requirements: ProcessWire 3.0.200+, PHP 8.2+

MIT License.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...