定制 jarir-ahmed/bd-mnp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jarir-ahmed/bd-mnp

Composer 安装命令:

composer require 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.

README 文档

README

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

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

Required columns (case-insensitive):

Column Description
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

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

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

importArray(array $records): int

Import from an array of associative records.

lookup(string $number): ?array

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

getOperatorName(int $rc): ?string

Resolve a routing code to operator name.

getDefaultOperators(): array

Get the default RC → operator mapping.

clear(): void

Clear all loaded entries.

count(): int

Number of loaded entries.

hasEntries(): bool

Whether any entries are loaded.

Operator Routing Codes

RC Operator
7, 13, 17 Grameenphone
6, 16, 18 Robi
9, 19 Banglalink
10, 15 Teletalk
1, 2, 3, 11 Citycell

Testing

composer install
composer test

License

MIT

bd-mnp

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固