承接 lalusahibul/fakenik 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lalusahibul/fakenik

最新稳定版本:v1.0.3

Composer 安装命令:

composer require lalusahibul/fakenik

包简介

Generator NIK untuk data dummy di Laravel

README 文档

README

Latest Stable Version Total Downloads License

FakeNIK is a Laravel library that generates random Indonesian National Identity Numbers (NIK). This library is very useful for dummy data purposes during application development or testing.

Table of Contents

Requirements

  • PHP ^8.0
  • Laravel ^9.0|^10.0|^11.0 (or the versions you support in your composer.json)

Installation

You can install this package via Composer. Run the following command in your terminal:

composer require lalusahibul/fakenik

Configuration

The package works out-of-the-box with sensible defaults. However, if you wish to customize these default values, you can easily publish the configuration file.

This allows you to change the default region codes (province, regency, district) and the default birth year range used when generating a NIK.

To publish the configuration file, run the following Artisan command in your terminal:

php artisan vendor:publish --tag=lalusahibul-fakenik

After that you can change default value in folder config/fakenik.php

//config/fakenik.php
'default_code' => [
        'province' => '52', // Example: Nusa Tenggara Barat
        'regency'  => '05', // Example: Kabupaten Dompu
        'district' => '06', // Example: Kecamatan Pekat
    ],
    'birth_year_range' => [
        'min' => 1970,
        'max' => 2010,
    ],

Usage

To get started, add the following use statements to your PHP file:

use Fakenik\Generator;
use Fakenik\DateOfBirth;

Examples

use Illuminate\Support\Facades\Route;
use Fakenik\Generator;
use Fakenik\DateOfBirth;

Route::get('/example', function () {
    // Generate a complete NIK using default settings.
    // The birth year range and default region codes are pulled from the `fakenik.php` config file.
    // To customize these values, you can publish the configuration file.
    $tahunLahir = DateOfBirth::generateBirthYear();
    $bulanLahir = DateOfBirth::generateBirthMonth();
    $tanggalLahir = DateOfBirth::generateBirthDay($bulanLahir, $tahunLahir);
    $nik = Generator::generate($tanggalLahir, $bulanLahir, $tahunLahir);
    return response()->json([
        'nik_tergenerate' => $nik,
        'detail_tanggal_lahir' => [
            'tanggal' => $tanggalLahir,
            'bulan' => $bulanLahir,
            'tahun' => $tahunLahir,
        ]
    ]);

License

License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-02