PHPackages                             salernolabs/phone - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. salernolabs/phone

ActiveLibrary

salernolabs/phone
=================

Utility for converting and formatting phone numbers

v1.0.0(5y ago)06MITPHPPHP &gt;=7.2

Since Dec 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/salernolabs/phone)[ Packagist](https://packagist.org/packages/salernolabs/phone)[ Docs](http://www.salernolabs.com/)[ RSS](/packages/salernolabs-phone/feed)WikiDiscussions main Synced 5d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Phone Number Formatter Utility
==============================

[](#phone-number-formatter-utility)

This is just a teeny tiny tested library for parsing, formatting, and validating phone numbers.

It is mostly aimed towards US formatting as many countries and customs have their own form of formatting phone numbers.

Installation
------------

[](#installation)

Use composer

```
composer require salernolabs/phone

```

Instantiate a class as necessary!

General Usage
-------------

[](#general-usage)

```
$phone = new \SalernoLabs\Phone\PhoneNumber('1234567890');
echo $phone->formatNumber();

```

If all works as expected this will output `1 (123) 456-7890`

You can also just `echo (string)$phone;`

It implements `\Serializable` so it should be serializable.

Class Documentation
-------------------

[](#class-documentation)

The class requires a valid phone number string to be entered as a constructor parameter. It is parsed at construction time. It may throw `\InvalidArgumentException` if it is unable to properly parse the phone number.

MethodInputsOutputsconstructorstring Phone Number (required)-getCountryCode-The parsed country codegetAreaCode-The parsed area code, empty string if nonegetNumber-The parsed local phone numbergetExtension-The parsed extension number if availableserialize-Returns the serialized representation of the numberunserializestring serialized versionThe unserialized version of the numberContributing
------------

[](#contributing)

Submit pull requests or fork it if you want. You are, after all, the Homerun Hitter of your Phone Number Formatter (sorry Chef John).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1973d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/155974?v=4)[Eric Salerno](/maintainers/ericsalerno)[@ericsalerno](https://github.com/ericsalerno)

---

Top Contributors

[![ericsalerno](https://avatars.githubusercontent.com/u/155974?v=4)](https://github.com/ericsalerno "ericsalerno (3 commits)")

---

Tags

phpformatterphone-number

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/salernolabs-phone/health.svg)

```
[![Health](https://phpackages.com/badges/salernolabs-phone/health.svg)](https://phpackages.com/packages/salernolabs-phone)
```

###  Alternatives

[laravel/pint

An opinionated code formatter for PHP.

3.1k147.7M13.2k](/packages/laravel-pint)[dragon-code/codestyler

A tool to automatically fix Coding Style Standards issues by The Dragon Code.

291.8M16](/packages/dragon-code-codestyler)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
