定制 jarir-ahmed/bd-nid-parser 二次开发

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

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

jarir-ahmed/bd-nid-parser

Composer 安装命令:

composer require jarir-ahmed/bd-nid-parser

包简介

Parse and validate Bangladesh National ID (NID) numbers. Extract number, digit type (10/17), date of birth, and name from raw OCR text. Zero dependencies.

README 文档

README

Parse and validate Bangladesh National ID (NID) numbers. Extract NID number, digit type (10-digit old card / 17-digit smart card), date of birth, and name from raw OCR text. Zero dependencies.

composer require jarir-ahmed/bd-nid-parser

Quick Start

use JarirAhmed\BdNid\BdNid;

// Parse full card OCR text
$result = BdNid::parse("Name: MD. JARIR AHMED NID: 4212964672 Date of Birth: 17 May 2000");
// [
//   'number'      => '4212964672',
//   'type'        => '10',
//   'name'        => 'MD. JARIR AHMED',
//   'dateOfBirth' => '2000-05-17',
// ]

// Validate NID number
BdNid::validate('4212964672');            // true
BdNid::validate('12345678901234567');     // true (smart card)
BdNid::validate('12345');                 // false

// Detect card type
BdNid::getDigitType('4212964672');        // '10'
BdNid::getDigitType('12345678901234567'); // '17'

API

parse(string $text): array

Extract NID number, type, name, and DOB from raw OCR text.

Returns:

  • number — NID number (digits only), or null
  • type'10' (old card) or '17' (smart card), or null
  • name — Person name in uppercase, or null
  • dateOfBirth — DOB in YYYY-MM-DD format, or null

validate(string $number): bool

Check if an NID number is valid (10 or 17 digits).

getDigitType(string $number): ?string

Detect card type: '10' or '17', returns null if invalid.

Supported DOB Formats

Format Example
Date of Birth: DD Mon YYYY Date of Birth: 17 May 2000
DD Mon YYYY (standalone) 05 January 1990
DD-MM-YYYY 01-12-1990
DD/MM/YYYY 15/06/1985
YYYY-MM-DD (ISO) 1990-01-17
DD-Mon-YYYY 01-Jan-1995

Supports both English and Bangla (নাম) name extraction.

Optional: NID Verification via nidlive.com

The package includes an optional NidLiveVerifier that integrates with nidlive.com — an identity verification service using image-based face/NID matching. This package uses their API for verification, and we credit them for providing this service.

To use the verifier, sign up at nidlive.com, purchase a subscription, and obtain your Client ID & Secret from the dashboard.

use JarirAhmed\BdNid\Verifiers\NidLiveVerifier;

$verifier = new NidLiveVerifier(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret'
);

// Submit NID front/back images + selfie for verification
$result = $verifier->submitVerification(
    nidFrontBase64: $frontImageBase64,
    nidBackBase64:  $backImageBase64,
    selfieBase64:   $selfieBase64,
);

// Check verification status
$status = $verifier->checkStatus('VRF-ABC123');

// Test API connectivity (no auth required)
$info = $verifier->testConnection();

nidlive.com Plans

Plan API Calls Rate Limit
Starter 1,000 / month 60 / minute
Professional 10,000 / month 300 / minute
Enterprise Custom Custom

Requires ext-curl and ext-json. See full API docs at nidlive.com/api-docs.

Testing

composer install
composer test

License

MIT

bd-nid-parser

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固