PHPackages                             jarir-ahmed/bd-mnp - 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. jarir-ahmed/bd-mnp

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

jarir-ahmed/bd-mnp
==================

Mobile Number Portability (MNP) lookup for Bangladesh. Detect ported numbers, resolve current and original operators from MNP routing codes, and import MNP CSV data.

v1.0.2(1mo ago)23MITPHPPHP &gt;=7.2

Since Jul 9Pushed 1mo agoCompare

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

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

bd-mnp
======

[](#bd-mnp)

**Mobile Number Portability (MNP) lookup for Bangladesh.** Detect ported numbers, resolve current and original operators from MNP routing codes, and import MNP CSV data. Zero core dependencies.

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

```

---

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

[](#quick-start)

```
use JarirAhmed\BdMnp\MnpLookup;

$mnp = new MnpLookup();

// Import MNP data from CSV (from National MNP database)
$mnp->importCsv('mnp_data.csv');

// Look up a number
$result = $mnp->lookup('01712345678');
// [
//   'number'           => '01712345678',
//   'ported'           => true,
//   'recipientRC'      => 17,
//   'donerRC'          => 19,
//   'currentOperator'  => 'Grameenphone',
//   'originalOperator' => 'Banglalink',
//   'portedDate'       => '2024-01-15',
// ]
```

Or import from arrays:

```
$mnp = new MnpLookup();
$mnp->importArray([
    ['number' => '0171000000', 'recipientRC' => 17, 'donerRC' => 19, 'portedDate' => '2024-01-15'],
    ['number' => '0182000000', 'recipientRC' => 18, 'donerRC' => 18], // not ported
]);
```

---

CSV Format
----------

[](#csv-format)

Required columns (case-insensitive):

ColumnDescription`number`Phone number prefix (e.g. `0171000000`)`portedDate`Date the number was ported`recipientRC`Current operator Routing Code`donerRC`Original operator Routing Code`nrhRC`Number Range Holder RC (optional)`numberType`Type of number (optional)`portedAction``ported` or empty (optional)API
---

[](#api)

### `importCsv(string $file, array $options): int`

[](#importcsvstring-file-array-options-int)

Import MNP data from a CSV file. Returns entry count.

### `importArray(array $records): int`

[](#importarrayarray-records-int)

Import from an array of associative records.

### `lookup(string $number): ?array`

[](#lookupstring-number-array)

Look up MNP info. Uses longest-prefix matching. Returns `null` if not found.

### `getOperatorName(int $rc): ?string`

[](#getoperatornameint-rc-string)

Resolve a routing code to operator name.

### `getDefaultOperators(): array`

[](#getdefaultoperators-array)

Get the default RC → operator mapping.

### `clear(): void`

[](#clear-void)

Clear all loaded entries.

### `count(): int`

[](#count-int)

Number of loaded entries.

### `hasEntries(): bool`

[](#hasentries-bool)

Whether any entries are loaded.

---

Operator Routing Codes
----------------------

[](#operator-routing-codes)

RCOperator7, 13, 17Grameenphone6, 16, 18Robi9, 19Banglalink10, 15Teletalk1, 2, 3, 11Citycell---

Testing
-------

[](#testing)

```
composer install
composer test
```

---

License
-------

[](#license)

MIT

bd-mnp
======

[](#bd-mnp-1)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

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

3

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 (3 commits)")

---

Tags

mobilenumberlookupmnpoperatorbangladeshportability

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mobiledetect/mobiledetectlib

Mobile\_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

10.7k174.7M562](/packages/mobiledetect-mobiledetectlib)[jenssegers/agent

Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

4.8k73.8M544](/packages/jenssegers-agent)[hisorange/browser-detect

Browser &amp; Mobile detection package for Laravel.

1.1k11.1M67](/packages/hisorange-browser-detect)[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4285.5M23](/packages/kwn-number-to-words)[lullabot/amp

A set of useful classes and utilities to convert html to AMP html (See https://www.ampproject.org/)

3823.0M12](/packages/lullabot-amp)[eo/passbook

iOS Passbook for PHP

2651.7M3](/packages/eo-passbook)

PHPackages © 2026

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