PHP code example of ballspins / nik-parser

1. Go to this page and download the library: Download ballspins/nik-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ballspins / nik-parser example snippets


use Ballspins\NikParser\NikParser;

$parser = new NikParser('3578201503990001');
$data = $parser->getDetails();

print_r($data);

use Ballspins\NikParser\NikGenerator;

// Generate NIK Pria
$nik = NikGenerator::generate('357820', new DateTime('1999-03-15'), 'pria');

// Generate NIK Wanita (Otomatis +40 pada tanggal lahir)
$nikWanita = NikGenerator::generate('357820', new DateTime('2001-08-12'), 'wanita');



use Ballspins\NikParser\NikParser;

$iterations = 1000000;
$parser = new NikParser('3578201503990001');

$start = microtime(true);
for($i = 0; $i < $iterations; $i++) { 
    $parser->kecamatan();
}
$end = microtime(true);

echo "Execution Time: " . round($end - $start, 4) . " seconds\n";
echo "Peak Memory: " . round(memory_get_peak_usage() / 1024 / 1024, 2) . " MB\n";