alexeevdv/indonesia-personal-id

1.0.1 2018-05-06 13:52 UTC

This package is auto-updated.

Last update: 2021-12-29 02:47:15 UTC


README

Build Status codecov PHP 5.6 PHP 7.0 PHP 7.1 PHP 7.2

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require alexeevdv/indonesia-personal-id "~1.0.0"

or add

"alexeevdv/indonesia-personal-id": "~1.0.0"

to the require section of your composer.json file.

Usage

Validator

use alexeevdv\personalid\indonesia\Validator;

$validator = new Validator;
$isValid = $validator->validate('NIK_TO_BE_VALIDATED');

Parser

use alexeevdv\personalid\indonesia\Parser;

$parser = new Parser;
// Returns identity instance
$identity = $parser->parse('NIK_TO_BE_PARSED');
echo $identity->birthDate()->format('Y-m-d');

Builder

use alexeevdv\personalid\indonesia\Builder;

$builder = new Builder;

$randomNik = $builder->random();

// Generates NIK from identity instance
$nikFromIdentity = $builder->fromIdentity($identity);

Identity

You can find full methods list in \alexeevdv\personalid\indonesia\Identity