Download the PHP package dekiakbar/indonesia-regions-php-client without Composer
On this page you can find all versions of the php package dekiakbar/indonesia-regions-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package indonesia-regions-php-client
Indonesia Regions PHP Client
About Indonesia Regions PHP Client
This package can be used to retrieve provinces, cities, districts and villages data from BPS. Note: Wherever you use this package please specify BPS as the data source.
Table of Contents
- Prerequisites
- Installation
- Usage
- License
Prerequisites
Before you install this package, make sure that the requirements below are met
Development (Docker)
For development you can use docker container for this project, here are step to reproduce docker env on your local env :
- Clone this repository:
git clone https://github.com/dekiakbar/indonesia-regions-php-client.git
- Navigate to project directory :
cd indonesia-regions-php-client
- Snd run :
docker-compose up -d
- Wait a few minutes, the image for docker will build automatic, after the build has been done you will get an image with the name indonesia-regions-php-client_app and a container with the name indonesia-regions-php-client_app_1 and indonesia-regions-php-client_mysql_1.
- Check if the container are exit, you can run :
docker ps -a
- If the container is not running, you can run :
docker start indonesia-regions-php-client_app_1
anddocker start indonesia-regions-php-client_mysql_1
- You can run interactive shell (SSH) :
docker exec -it indonesia-regions-php-client_app_1 /bin/bash
- NOTE:
- The indonesia-regions-php-client_app_1 container is used to mount the directory project.
- The indonesia-regions-php-client_mysql_1 container is used to save the database from project.
- The default docker workdir is app for indonesia-regions-php-client_app_1 container.
- The app directory is mounted from indonesia-regions-php-client host directory, so if you edit the file inside indonesia-regions-php-client in the host Operating system, the file inside docker will be changed or vice versa, the reason I made docker container mount the project root a.k.a indonesia-regions-php-client to the app because I am too lazy to mount file from docker, so if docker mount file from indonesia-regions-php-client root directory I can simple edit the file directly from my favorite IDE :stuck_out_tongue_closed_eyes:
Installation
$ composer require dekiakbar/indonesia-regions-php-client
- And You're done.
Usage
- You can pass the parameter to the method, All of this package has 3 mode :
- For BPS and POS mode you can use BPS Id/Code to retrieve province / city / subdistrict / village data. But you Can Not use BPS Id/Code to retrieve province / city / subdistrict / village data if you use dagri mode, please use dagri Id/code to retrieve province / city / subdistrict / village data.
- If mode is NULL, then the method will use default mode, default mode is bps.
- bps : only return : kode and nama of province / city / subdistrict / village.
- dagri : return : kode_bps, nama_bps, kode_dagri, nama_dagri of province / city / subdistrict / village.
- pos : return : kode_bps, nama_bps, kode_pos, nama_pos of province / city / subdistrict / village.
Note
- Not all method always return
list
anddetail
object, on some method only returnlist
ordetail
you must check it again before you use the response. - If you just need the data (not planing to use this API), just import the Database Dump on
export
folder, extractindonesia_regions_pos.tar.gz
and import to your database. - If you want to retrieve data with mode Dagri please fill Parent Id (Provinde Id / City Id / Subdistrict Id) with valid data. Parent Id for POS and Dagri are different. You can get the city Id
(kode)
from$region->getCityListByProvinceId('pos',$provinceId)->list
. -
please remeber if you want fetch any data you must use parent Id (province Id / City Id / Subdistrict Id) from list collection, NOT from detail collection (If you use ID from detail it will work but you will get duplicate data).
-
Retrieve All province data
-
Retrieve City List By Province Id
-
Retrieve Subdistrict List By City Id
-
Retrieve Village List By Subdistrict Id
-
Retrieve ISO 3166-2 code for province
Note : This method only for province
License
- MIT license
- Copyright 2020 © Deki Akbar.
All versions of indonesia-regions-php-client with dependencies
ext-json Version *
ext-curl Version *
illuminate/support Version ^5.5|^6.0|^7.0|^8.0|^9.0