npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ribertec/directus-extension-phone-parser

v1.3.0

Published

Parse and validate international phone numbers in Directus Flows using libphonenumber-js

Readme

Phone Parser for Directus

A Directus Flow operation that parses and validates international phone numbers. Uses libphonenumber-js to extract structured data from any phone number.

Extension demo GIF

Features

  • Parses international phone numbers in E.164 format (e.g. +5531988884444)
  • Accepts flexible input formats — with or without +, with spaces, dashes, and parentheses
  • Supports a Default Country option for parsing national numbers without a + prefix
  • Returns phone type (MOBILE, FIXED_LINE, FIXED_LINE_OR_MOBILE, etc.)
  • Returns both raw and formatted national number
  • Validates phone number correctness via libphonenumber-js
  • Returns structured error output for invalid or missing input
  • Works in any Directus Flow as a custom operation

Installation

Via Directus Marketplace (Recommended)

  1. Navigate to your Directus project
  2. Go to SettingsExtensions
  3. Search for "Phone Parser"
  4. Click Install

Via npm

npm install @ribertec/directus-extension-phone-parser

Then restart your Directus instance.

Usage

Add the Phone Parser operation to any Directus Flow.

Input

| Field | Required | Description | | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | phone | Yes | Phone number to parse. Include + and country code (e.g. +5531988884444), or omit + if Default Country is set. | | defaultCountry | No | ISO 3166-1 alpha-2 country code (e.g. BR, US, GB). Used to interpret national numbers without a + prefix. Ignored when + is present. |

Example inputs:

+5531988884444         → E.164 format (recommended)
+55 (31) 98888-4444    → with spaces and punctuation
31988884444            → national format, requires defaultCountry: "BR"

Output

On success:

{
  "success": true,
  "fullNumber": "+5531988884444",
  "type": "MOBILE",
  "country": "BR",
  "countryCode": "55",
  "rawNumber": "31988884444",
  "formattedNumber": "(31) 98888-4444",
  "internationalNumber": "+55 31 98888-4444",
  "valid": true
}

| Field | Description | | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | success | true when the number was parsed successfully | | fullNumber | Normalized E.164 number (e.g. +5531988884444) | | type | Phone type: MOBILE, FIXED_LINE, FIXED_LINE_OR_MOBILE, TOLL_FREE, PREMIUM_RATE, TOLL_FREE, SHARED_COST, VOIP, PERSONAL_NUMBER, PAGER, UAN, VOICEMAIL | | country | ISO 3166-1 alpha-2 country code (e.g. BR) | | countryCode | International dialing country code (e.g. 55) | | rawNumber | National number digits only, without country code (e.g. 31988884444) | | formattedNumber | Nationally formatted number (e.g. (31) 98888-4444) | | internationalNumber | Internationally formatted number (e.g. +55 31 98888-4444) | | valid | true if the number is valid according to libphonenumber-js |

On failure:

{
  "success": false,
  "error": "No phone number provided"
}

Requirements

  • Directus 10.10.0+ or 11.0.0+

License

MIT License — see LICENSE file for details