teguh02/php_indonesia_region

印度尼西亚国家地区PHP API,无需数据库即可使用

v1.0 2023-04-08 22:35 UTC

This package is auto-updated.

Last update: 2024-09-09 01:38:52 UTC


README

为什么使用这个包?因为这个包无需使用数据库,只需使用此包,即可获取印度尼西亚所有地区

安装

使用composer命令安装

composer require teguh02/php_indonesia_region

用法

PROVINCE

获取所有省份

$province = Region::query("all provinces") -> get();

通过id获取一个省份

$province = Region::query("province with id = 36") -> get();

通过数组id获取一个省份

$province = Region::query("provinces with id in array [36, 51, 34, 61, 71]") -> get();

REGENCY

获取id为36的省份的所有区

$regencies = Region::query("regencies with id_province = 33") -> get();

获取id为32, 33的省份的所有区

$regencies = Region::query("regencies with id_province in array [32, 33]") -> get();

DISTRICT

获取id为3201的区的所有镇

$districts = Region::query("districts with id_regency = 3302") -> get();

VILLAGE

获取id为330227的镇的所有村庄

$villages = Region::query("villages with id_district = 330227") -> get();