harrym/indonesian-regions

Indonesian Region Database for Laravel

Maintainers

Package info

github.com/harrymahardhika/indonesian-regions

Homepage

pkg:composer/harrym/indonesian-regions

Statistics

Installs: 42

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-02-21 18:01 UTC

This package is auto-updated.

Last update: 2026-02-21 19:47:21 UTC


README

Latest Version on Packagist Total Downloads License

A fast, lightweight, and modern Indonesian Region Database (Provinsi, Kota/Kabupaten, Kecamatan, Kelurahan/Desa) package for Laravel.

Installation

You can install the package via composer:

composer require harrym/indonesian-regions

After installation, publish the database migrations and configuration:

php artisan vendor:publish --provider="HarryM\IndonesianRegions\IndonesianRegionsServiceProvider"

Then run the migrations to create the required tables:

php artisan migrate

Finally, seed the regions database (this process handles bulk upserts securely and efficiently):

php artisan db:seed --class="HarryM\IndonesianRegions\Database\Seeders\RegionSeeder"

Structure

The provided datasets contain data mapped into four levels of regions:

  • AreaProvince (Provinces)
  • AreaCity (Cities & Regencies / Kota & Kabupaten)
  • AreaDistrict (Districts / Kecamatan)
  • AreaSubdistrict (Subdistricts & Villages / Kelurahan & Desa)

Usage

All Area models use Laravel's standard Eloquent system. You can interact with them statically or via relationships:

use HarryM\IndonesianRegions\Models\AreaProvince;
use HarryM\IndonesianRegions\Models\AreaCity;

// Get all provinces
$provinces = AreaProvince::all();

// Get the cities of a specific province using relationship
$province = AreaProvince::where('name', 'DKI JAKARTA')->first();
$jakartaCities = $province->cities;

// Get the district associated with a city
$city = AreaCity::where('name', 'KOTA JAKARTA SELATAN')->first();
$districts = $city->districts;

// Get subdistricts of a specific district
$district = $city->districts()->first();
$subdistricts = $district->subdistricts;

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.