https://github.com/zerosdev/nik-reader
Identity data reader based on NIK (Nomor Induk Kependudukan)
https://github.com/zerosdev/nik-reader
hacktoberfest ktp nik
Last synced: 6 months ago
JSON representation
Identity data reader based on NIK (Nomor Induk Kependudukan)
- Host: GitHub
- URL: https://github.com/zerosdev/nik-reader
- Owner: zerosdev
- License: mit
- Created: 2021-05-25T16:50:35.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T13:33:11.000Z (over 4 years ago)
- Last Synced: 2024-08-10T19:21:32.624Z (over 1 year ago)
- Topics: hacktoberfest, ktp, nik
- Language: PHP
- Homepage:
- Size: 167 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NIK Reader
Identity data reader based on NIK (Nomor Induk Kependudukan)
## About
This library gives you a way to convert the NIK number into useful information such as: Region name (province, city, sub-district), date of birth, gender, zodiac, age, and more. This can also be used to validate whether the NIK number is valid or not.
Here is the example result :
```json
{
"valid": true,
"nik": "3502200101000001",
"province_id": "35",
"province": "JAWA TIMUR",
"city_id": "3502",
"city": "KAB. PONOROGO",
"subdistrict_id": "350220",
"subdistrict": "JAMBON",
"postal_code": "63456",
"birthday": "01-01-2000",
"age":
{
"year": 21,
"month": 9,
"day": 25
},
"zodiac": "Capricorn",
"gender": "male",
"unique_code": "0001"
}
```
## Installation
1. Run command
composer require zerosdev/nik-reader
## Usage
### Laravel
```php
// .........
public function method()
{
$nik = '3502200101910001';
$result = \NikReader::read($nik);
if (true === $result->valid) {
// code
}
}
```
### Non-Laravel
```php
read($nik);
if (true === $result->valid) {
// code
}
```
### Available Methods
| Method | Description |
|---------------------------|----------------------------------|
| read() | Start reading NIK number |
| valid() | Check wether NIK is valid or not |
| setDatabase() | Load database file |
| getProvince() | Get province data |
| getCity() | Get city data |
| getSubdistrict() | Get subdistrict data |
| getPostalCode() | Get postal code data |
| getBornDate() | Get date of birth data |
| getAge() | Get age data |
| getZodiac() | Get zodiac data |
| getGender() | Get gender data |
| getUniqueCode() | Get unique code |
| toArray() | Convert result into Array format |
| toJSON() | Convert result into JSON format |