PHPackages                             renderbit/normalize-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. renderbit/normalize-phone

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

renderbit/normalize-phone
=========================

Normalize phone numbers (with or without country code)

v2.0.0(2y ago)13.5kMITPHPPHP ~7.1|^8.0

Since Feb 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/RenderbitTechnologies/normalize-phone)[ Packagist](https://packagist.org/packages/renderbit/normalize-phone)[ Docs](https://github.com/RenderbitTechnologies/normalize-phone)[ RSS](/packages/renderbit-normalize-phone/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

normalize-phone
===============

[](#normalize-phone)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9776d38945654a74f7dd7ae3011103b5dcf0afd750d3b7ac8e774b6111aec8db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656e6465726269742f6e6f726d616c697a652d70686f6e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/renderbit/normalize-phone)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/2a318ab70c0e5b68229141af5ba66bcf8d22272ae541acb233c4ada40e91150d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f52656e646572626974546563686e6f6c6f676965732f6e6f726d616c697a652d70686f6e652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/RenderbitTechnologies/normalize-phone)[![Coverage Status](https://camo.githubusercontent.com/4dc8ce33c653febbced3d6c5f1892b6b60a8e70d7f646aa609601ef21c4e0dff/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f52656e646572626974546563686e6f6c6f676965732f6e6f726d616c697a652d70686f6e652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/RenderbitTechnologies/normalize-phone/code-structure)[![Quality Score](https://camo.githubusercontent.com/884dd69b4b9d763328a3f278c08bb8e4ad9dd7dd37d9acdabccc2fc7da559d84/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f52656e646572626974546563686e6f6c6f676965732f6e6f726d616c697a652d70686f6e652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/RenderbitTechnologies/normalize-phone)[![Total Downloads](https://camo.githubusercontent.com/47b856168ea3ee1b3e28f460257c97a1596c470569dbcaeab88cfc88f18cc607/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656e6465726269742f6e6f726d616c697a652d70686f6e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/renderbit/normalize-phone)

Normalize a phone number (with or without country code).

Background
----------

[](#background)

We needed to send phone numbers to a third-party API as an amalgamation of the phone number and the country code, without the plus sign, brackets or any other special characters such as hyphens or spaces. We built this package as a solution to automatically parse user-input phone numbers and pass them as-is to the API, if already in the correct format - otherwise amend them and send the formatted numbers to the API.

This package looks for the environment variable `PHONE_DEFAULT_COUNTRY_CODE` to define the base country code to be prepended to the numbers with no country code. If no such variable is define, the package assumes a default of India (`91`).

Install
-------

[](#install)

Via Composer

```
$ composer require renderbit/normalize-phone
```

Usage
-----

[](#usage)

```
normalize_phone('9434012345');        // '919434012345'
normalize_phone('+919434012345');     // '919434012345'
normalize_phone('+91-9434012345');    // '919434012345'
normalize_phone('+19434012345');      // '19434012345'
normalize_phone('+91 9434012345');    // '919434012345'
normalize_phone('(+91) 94340 12345'); // '919434012345'
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email “contact `at` renderbit `dot` com” instead of using the issue tracker.

Credits
-------

[](#credits)

- [Renderbit Technologies](https://github.com/RenderbitTechnologies)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~872 days

Total

3

Last Release

942d ago

Major Versions

v1.0.1 → v2.0.02023-12-04

PHP version history (2 changes)v1.0.0PHP ~7.1

v2.0.0PHP ~7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16665819?v=4)[Renderbit Technologies](/maintainers/renderbit-technologies)[@renderbit-technologies](https://github.com/renderbit-technologies)

---

Top Contributors

[![soham2008xyz](https://avatars.githubusercontent.com/u/7334295?v=4)](https://github.com/soham2008xyz "soham2008xyz (6 commits)")

---

Tags

phone-formatphone-numberphpphp-libphp-libraryphp5php7RenderbitTechnologiesnormalize-phone

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[popo/generator

Plain Old PHP Object (POPO) / Data Structure / Data Transfer Object (DTO) Generator. Convert YAML schema to PHP class.

2140.5k9](/packages/popo-generator)

PHPackages © 2026

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