PHPackages                             jarir-ahmed/bd-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. jarir-ahmed/bd-phone

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

jarir-ahmed/bd-phone
====================

Bangladesh phone number toolkit: normalize, validate, format, detect operator and number type.

v1.0.1(1mo ago)26MITPHPPHP &gt;=7.2

Since Jul 9Pushed 1mo agoCompare

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

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

bd-phone
========

[](#bd-phone)

**Bangladesh phone number toolkit** — normalize, validate, format, detect operator and number type. Zero dependencies.

```
composer require jarir-ahmed/bd-phone

```

---

Quick Start
-----------

[](#quick-start)

```
use JarirAhmed\BdPhone\BdPhone;

// Normalize to E.164
BdPhone::normalize('01712345678');      // +8801712345678
BdPhone::normalize('+8801712345678');   // +8801712345678
BdPhone::normalize('008801712345678');  // +8801712345678

// Validate
BdPhone::validate('01712345678');       // true
BdPhone::validate('01112345678');       // false (invalid prefix)

// Format
BdPhone::format('01712345678', 'local');       // 01712 345678
BdPhone::format('01712345678', 'local_dash');  // 01712-345678
BdPhone::format('01712345678', 'intl');        // +880 1712 345678
BdPhone::format('01712345678', 'intl_dash');   // +880-1712-345678
BdPhone::format('01712345678', 'e164');        // +8801712345678

// Detect operator
BdPhone::getOperator('01712345678');    // Grameenphone
BdPhone::getOperator('01812345678');    // Robi
BdPhone::getOperator('01912345678');    // Banglalink
BdPhone::getOperator('01512345678');    // Teletalk

// Number type
BdPhone::getNumberType('01712345678');  // mobile

// Full info
BdPhone::info('01712345678');
// [
//   'normalized'    => '+8801712345678',
//   'valid'         => true,
//   'operator'      => 'Grameenphone',
//   'type'          => 'mobile',
//   'local'         => '01712 345678',
//   'international' => '+880 1712 345678',
// ]
```

---

Supported Operators
-------------------

[](#supported-operators)

PrefixOperator013, 017Grameenphone016, 018Robi014, 019Banglalink015Teletalk---

API
---

[](#api)

### `normalize(string $number): string`

[](#normalizestring-number-string)

Convert to E.164 format (`+8801XXXXXXXXX`). Returns empty string if unparseable.

### `validate(string $number): bool`

[](#validatestring-number-bool)

Check if the number is a valid Bangladeshi phone number with a known operator prefix.

### `format(string $number, string $format): string`

[](#formatstring-number-string-format-string)

Format into one of: `e164`, `local`, `local_dash`, `intl`, `intl_dash`.

### `getOperator(string $number): ?string`

[](#getoperatorstring-number-string)

Detect mobile operator. Returns `null` if unknown.

### `getNumberType(string $number): ?string`

[](#getnumbertypestring-number-string)

Identify type: `mobile`, or `null` if unknown.

### `info(string $number): array`

[](#infostring-number-array)

Return all data as an associative array.

---

Testing
-------

[](#testing)

```
composer install
composer test
```

---

License
-------

[](#license)

MIT

jarir-ahmed-bd-phone
====================

[](#jarir-ahmed-bd-phone)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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 ~1 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20700f34ff813055154e843bbdbe04d33320c1e6a81bbb3301cad67cb8350fd3?d=identicon)[jarircse16](/maintainers/jarircse16)

---

Top Contributors

[![jarir2020](https://avatars.githubusercontent.com/u/175597633?v=4)](https://github.com/jarir2020 "jarir2020 (2 commits)")

---

Tags

phoneformatvalidatenumberoperatorbangladeshbd

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jarir-ahmed-bd-phone/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.7k943.2M1.9k](/packages/webmozart-assert)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k41.2M168](/packages/propaganistas-laravel-phone)[jackocnr/intl-tel-input

A JavaScript library for entering and validating international telephone numbers

8.2k296.8k2](/packages/jackocnr-intl-tel-input)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.4M34](/packages/wixel-gump)[dniccum/phone-number

A Laravel Nova phone number field with input masking and validation support.

70476.4k](/packages/dniccum-phone-number)[abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP &gt;= 8.1.

312.1M3](/packages/abcaeffchen-sepa-utilities)

PHPackages © 2026

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