explaingit

bensondevs/indonesian-ktp

Analysis updated 2026-05-18

21PHPAudience · developerComplexity · 2/5Setup · easy

TLDR

A PHP library that validates Indonesian national identity numbers (NIK) and checks them against real administrative regions.

Mindmap

mindmap
  root((Indonesian KTP NIK))
    What it does
      Validates NIK structure
      Checks region codes
      Laravel integration
    Tech stack
      PHP
      Laravel
      Eloquent
    Use cases
      Form validation
      Registration systems
      HR systems
    Audience
      PHP developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Reject malformed Indonesian NIK numbers on a registration or government service form.

USE CASE 2

Verify that a NIK's birth date, gender, and province match expected values using a fluent API.

USE CASE 3

Add NIK-aware validation directly to a Laravel Eloquent model.

USE CASE 4

Cross-check a NIK's embedded district code against a bundled dataset without a database call.

What is it built with?

PHPLaravelEloquent

How does it compare?

bensondevs/indonesian-ktpfzw005421/wanfeng-videoiamjohnwhite/bricks-floating-panels
Stars212121
LanguagePHPPHPPHP
Setup difficultyeasyhardeasy
Complexity2/53/52/5
Audiencedeveloperdeveloperdesigner

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires PHP 8.3 or higher, Laravel integration needs Laravel 10 through 13.

In plain English

Indonesian KTP (NIK) Validation is a PHP library that checks whether an Indonesian national identity number, called a NIK (Nomor Induk Kependudukan), is structurally valid and refers to a real administrative region. Every Indonesian citizen has a 16-digit NIK on their KTP (identity card) that encodes their province, regency, subdistrict, birth date, gender, and a serial number. This library validates that structure and cross-references the embedded district code against a bundled dataset of Indonesian administrative regions (called wilayah), so no database query is needed at runtime. You can use it as a standalone PHP class by calling a fluent API, for example, checking that a NIK belongs to a male person born on a specific date in Central Java, or you can plug it directly into Laravel's validation system as a custom rule. The library supports chaining optional expectations for birth date, age, gender, province, regency, and subdistrict, and returns either a simple true/false or a detailed result object that tells you exactly which checks passed or failed. It also includes a trait for Laravel's Eloquent ORM that adds NIK-aware methods to a database model. You would use this when building a PHP or Laravel application that collects Indonesian identity numbers, for instance, a government service, a fintech registration form, or an HR system, and needs to reject malformed or nonsensical NIK values before saving them. The library requires PHP 8.3 or higher and Laravel 10 through 13. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
Add this Indonesian KTP NIK validation library to my Laravel project as a custom validation rule.
Prompt 2
Show me how to check a NIK for a specific gender, birth date, and province using this library's fluent API.
Prompt 3
Use the Eloquent trait from this library to add NIK-aware methods to my user model.
Prompt 4
Explain what information is encoded in a 16-digit Indonesian NIK and how this library checks it.

Frequently asked questions

What is indonesian-ktp?

A PHP library that validates Indonesian national identity numbers (NIK) and checks them against real administrative regions.

What language is indonesian-ktp written in?

Mainly PHP. The stack also includes PHP, Laravel, Eloquent.

How hard is indonesian-ktp to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is indonesian-ktp for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.