zerosdev/nik-reader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

zerosdev/nik-reader

最新稳定版本:v1.0.0

Composer 安装命令:

composer require zerosdev/nik-reader

包简介

Identity data reader based on NIK (Nomor Induk Kependudukan)

README 文档

README

Identity data reader based on NIK (Nomor Induk Kependudukan)

build release language license size downloads pulls

About

This library gives you a way to convert the NIK number into useful information such as: Region name (province, city, sub-district), date of birth, gender, zodiac, age, and more. This can also be used to validate whether the NIK number is valid or not. Here is the example result :

{
    "valid": true,
    "nik": "3502200101000001",
    "province_id": "35",
    "province": "JAWA TIMUR",
    "city_id": "3502",
    "city": "KAB. PONOROGO",
    "subdistrict_id": "350220",
    "subdistrict": "JAMBON",
    "postal_code": "63456",
    "date_of_birth": "01-01-2000",
    "age": {
        "year": 21,
        "month": 9,
        "day": 25
    },
    "zodiac": "Capricorn",
    "gender": "male",
    "unique_code": "0001"
}

Installation

  1. Run command
composer require zerosdev/nik-reader

Usage

Laravel

// .........
public function method()
{
    $nik = '3502200101910001';
    $result = \NikReader::read($nik);

    if (true === $result->valid) {
        // code
    }
}

Non-Laravel

<?php

require 'path/to/your/vendor/autoload.php';

use ZerosDev\NikReader\Reader;

$nik = '3502200101910001';
$reader = new Reader();
$result = $reader->read($nik);

if (true === $result->valid) {
    // code
}

Reading Multiple NIKs

When reading multiple NIKs, you have two options:

Option 1: Using the same instance (recommended)

$reader = new Reader();

// Read first NIK
$result1 = $reader->read('3502200101910001');
echo $result1->date_of_birth; // 01-01-1991

// Read second NIK (overwrites previous data)
$result2 = $reader->read('3502201101910001');
echo $result2->date_of_birth; // 11-01-1991

// Note: $result1 and $result2 are the same object!

Available Methods

Method Description
read() Start reading NIK number
valid() Check wether NIK is valid or not
setDatabase() Load database file
getProvince() Get province data
getCity() Get city data
getSubdistrict() Get subdistrict data
getPostalCode() Get postal code data
getDateOfBirth() Get date of birth data
getAge() Get age data
getZodiac() Get zodiac data
getGender() Get gender data
getUniqueCode() Get unique code
toArray() Convert result into Array format
toJSON() Convert result into JSON format

统计信息

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

GitHub 信息

  • Stars: 25
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固