zerosdev/nik-reader

Identity data reader based on NIK (Nomor Induk Kependudukan)

v0.2.1 2021-11-05 13:31 UTC

This package is auto-updated.

Last update: 2024-11-05 20:13:44 UTC


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",
    "birthday": "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
}

Available Methods