PHPackages                             propertyguru/e164-phone-number-formatter-bundle - 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. propertyguru/e164-phone-number-formatter-bundle

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

propertyguru/e164-phone-number-formatter-bundle
===============================================

Propertygurus's phone number formatter

v1.0(10y ago)24961PHPPHP &gt;=5.4

Since Sep 23Pushed 10y ago2 watchersCompare

[ Source](https://github.com/propertyguru/e164-phone-number-formatter-bundle)[ Packagist](https://packagist.org/packages/propertyguru/e164-phone-number-formatter-bundle)[ RSS](/packages/propertyguru-e164-phone-number-formatter-bundle/feed)WikiDiscussions master Synced 3w ago

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

[![Build Status](https://camo.githubusercontent.com/7286b5e3e26923bc2b394f19185cb8eac7530e82529497975d2fe786adbcd4a0/68747470733a2f2f7472617669732d63692e6f72672f70726f7065727479677572752f453136342d70686f6e652d6e756d6265722d666f726d61747465722d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/propertyguru/E164-phone-number-formatter-bundle)

E164-phone-number-formatter-bundle
==================================

[](#e164-phone-number-formatter-bundle)

Symfony2 bundle to format phone numbers in [E164 format](https://en.wikipedia.org/wiki/E.164).

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

[](#installation)

Add the repository to your composer.json file

```
// composer.json

{
    "require": {
        // ...
        "propertyguru/E164-phone-number-formatter-bundle" : "dev-master"
    }
}
```

Register the bundle in your AppKernel:

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Guru\PhoneNumberFormatterBundle\GuruPhoneNumberFormatterBundle(),
        // ...
    );
}
```

Usage
-----

[](#usage)

Setup

```
$formatter = $this->container->get('guru_phone_number_formatter.formatter');
// optional: set current country - if known
$formatter->setDefaultRegionCode('my');

```

If you know the country code already

```
$e164 = $formatter->numberToE164('0101234567', '60');

```

If the country code if embedded in the number

```
$e164 = $formatter->numberToE164('+60101234567');

```

If you are not sure if the country code is embedded or not

```
$e164 = $formatter->numberToE164('+60101234567', '60');

```

All of the above will output

```
array(
   'countryCode' => '60',
   'nationalDestinationCode' => '010',
   'nationalDestinationCodeInternational' => '10',
   'subscriberNumber' => '1234567',
   'isMobile' => true,
)

```

Embedded country code has precedence over specified country code

```
$e164 = $formatter->numberToE164('+65101234567', '60');

```

and will output:

```
array(
   'countryCode' => '65',
   'nationalDestinationCode' => NULL,
   'nationalDestinationCodeInternational' => NULL,
   'subscriberNumber' => '101234567',
   'isMobile' => false,
)

```

Weighted results
----------------

[](#weighted-results)

Weights can be defined that some country codes are preffered over others. If a number can match more than one country, then only the one with the highest weight is considered

```
$formatter->setRegionWeights(array(
    'my' => 1,
    'sg' => 2
));

```

Example : 98123123 can be either a malaysia or singaporean phone number.

Contributors
------------

[](#contributors)

- [Andrei Blotzu](https://github.com/blotzu)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58% 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

3867d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60c6b60ef3ebb3bca6e7db4b5b38672ab361d8f17f666c40e88f3d104a4453f5?d=identicon)[devzer01](/maintainers/devzer01)

![](https://www.gravatar.com/avatar/deccfed413908cea81314ba0ca6804cb77bc0b5ba9f67883ee71cd8d38efcf0e?d=identicon)[blotzu](/maintainers/blotzu)

---

Top Contributors

[![andrei-propertyguru](https://avatars.githubusercontent.com/u/12060611?v=4)](https://github.com/andrei-propertyguru "andrei-propertyguru (29 commits)")[![nicodemuz](https://avatars.githubusercontent.com/u/1620454?v=4)](https://github.com/nicodemuz "nicodemuz (16 commits)")[![PMPP](https://avatars.githubusercontent.com/u/311076?v=4)](https://github.com/PMPP "PMPP (4 commits)")[![scalopus](https://avatars.githubusercontent.com/u/773780?v=4)](https://github.com/scalopus "scalopus (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/propertyguru-e164-phone-number-formatter-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/propertyguru-e164-phone-number-formatter-bundle/health.svg)](https://phpackages.com/packages/propertyguru-e164-phone-number-formatter-bundle)
```

###  Alternatives

[magyarjeti/laravel-lipsum

Lorem ipsum generator for Laravel Framework

1617.9k](/packages/magyarjeti-laravel-lipsum)

PHPackages © 2026

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