risan/ktp

HTTP client library for finding 2014 Indonesian presidential election voter's data based on it's NIK

v1.1.1 2016-03-09 13:29 UTC

This package is auto-updated.

Last update: 2024-12-17 20:53:20 UTC


README

Build Status HHVM Status StyleCI Scrutinizer Code Quality Code Coverage SensioLabs Insight Latest Stable Version License

PHP HTTP client library for finding 2014 Indonesian presidential election voter's data based on it's NIK. The data is directly scraped from KPU website website.

Table of Contents

Dependencies

This package powered by the following awesome libraries:

Installation

The recommended way to install this package is through Composer. With the Composer installed on your machine, simply run the following command inside your project directory:

composer require risan/ktp

You may also add risan\ktp package directly into your composer.json file:

"require": {
  "risan/ktp": "~1.1"
}

Once your composer.json file is updated, run the following command to install it:

composer install

How to Use

Here's some example about how to use this package:

// Include composer autoloder file.
require 'vendor/autoload.php';

// Create a new instance Ktp\Finder.
$ktp = new Ktp\Finder();

// Find a voter's data by it's NIK.
$data = $ktp->findByNik(1122330108901234);

// Voter's data is not found.
if (is_null($data)) {
    die('Not found!');
}

print_r($data);

If the given NIK is not found, the findByNik() method will return a null value.

If the given NIK is found, the findByNik() will return an array that holds the voter's data. The returned array will have the following structure:

Array
(
    [nik] => 1122330108901234
    [name] => RISAN BAGJA
    [jenis_kelamin] => LAKI-LAKI
    [kelurahan] => KAMPUNG BARU
    [kecamatan] => BANDA
    [kabupaten_kota] => MALUKU TENGAH
    [provinsi] => MALUKU UTARA
)