PHP code example of zerosdev / nik-reader

1. Go to this page and download the library: Download zerosdev/nik-reader 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/ */

    

zerosdev / nik-reader example snippets


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

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



erosDev\NikReader\Reader;

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

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

$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!