PHPackages                             componenta/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. componenta/phone

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

componenta/phone
================

Phone number value object backed by libphonenumber

v1.0.0(1mo ago)00MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/componenta/phone)[ Packagist](https://packagist.org/packages/componenta/phone)[ RSS](/packages/componenta-phone/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Componenta Phone
================

[](#componenta-phone)

Phone number value object backed by `giggsey/libphonenumber-for-php`.

Use it when phone numbers should be validated, normalized to E.164, formatted for UI, and serialized as a stable string.

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

[](#installation)

```
composer require componenta/phone
```

Related Packages
----------------

[](#related-packages)

This package is standalone but relies on `giggsey/libphonenumber-for-php`.

PackageWhy it may be used nearby`componenta/validation`Validates raw phone input before creating `Phone`.`componenta/auth`Can use phone numbers for OTP or passwordless flows.`componenta/cqrs`Registration/profile commands can type phone fields with this value object.Usage
-----

[](#usage)

```
use Componenta\Stdlib\Phone;

$phone = Phone::create('916 123-45-67', region: 'RU');

(string) $phone;          // "+79161234567"
$phone->toInternational();
$phone->toNational();
$phone->toRfc3966();
$phone->countryCode();    // 7
$phone->detectedRegion(); // "RU"
```

Constructors
------------

[](#constructors)

- `Phone::create($phone, $region = 'RU')` parses and validates raw input
- `Phone::fromE164($e164)` creates from a pre-normalized E.164 string and still validates it
- `Phone::tryCreate($phone, $region = 'RU')` returns `null` instead of throwing

The region is only a parsing hint for local formats. Numbers starting with `+` are parsed region-agnostically. The stored value is always E.164.

Validation And Errors
---------------------

[](#validation-and-errors)

Invalid input throws `InvalidArgumentException`. Static `isValid()` can be used for boolean checks when no value object is needed.

Serialization
-------------

[](#serialization)

`__toString()` and `jsonSerialize()` return the E.164 value. `masked()` preserves the country code and the last four digits for logs and UI.

Performance
-----------

[](#performance)

The parsed `PhoneNumber` instance is created lazily and cached on the value object after the first formatting/classification call.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

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

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

###  Alternatives

[verbb/formie

The most user-friendly forms plugin for Craft.

101393.6k74](/packages/verbb-formie)[brick/phonenumber

Phone number library

4327.8M65](/packages/brick-phonenumber)[odolbeau/phone-number-bundle

Integrates libphonenumber into your Symfony application

24811.2M19](/packages/odolbeau-phone-number-bundle)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13725.8k63](/packages/skeeks-cms)[fleetbase/fleetops-api

Fleet &amp; Transport Management Extension for Fleetbase

1731.5k8](/packages/fleetbase-fleetops-api)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10244.2k5](/packages/bitrix24-b24phpsdk)

PHPackages © 2026

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