Download the PHP package azishapidin/indoregion without Composer

On this page you can find all versions of the php package azishapidin/indoregion. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package indoregion

azishapidin/indoregion

Tests StyleCI License Latest Stable Version Total Downloads GitHub Stars GitHub Forks

azishapidin/indoregion adalah package Laravel yang berisi data wilayah administratif Indonesia, mulai dari Provinsi, Kabupaten/Kota, Kecamatan, sampai Desa/Kelurahan. Package ini menambahkan migration, seeder (untuk mengimpor data ke database), dan Model ke project Anda.

Semua data disimpan di database Anda sendiri, sehingga bisa diambil seperti model Eloquent pada umumnya (lihat bagian Penggunaan Dasar).

Data

Data mengikuti Kepmendagri No. 300.2.2-2430 Tahun 2025 tentang Pemberian dan Pemutakhiran Kode dan Data Wilayah Administrasi Pemerintahan dan Pulau, yang diambil dari cahyadsn/wilayah (lisensi MIT). Kode wilayah sama dengan yang dipakai di NIK, sehingga 6 digit pertama NIK adalah kode kecamatan.

Level Tabel Jumlah Format ID Contoh
Provinsi provinces 38 2 digit 61 (Kalimantan Barat)
Kabupaten/Kota regencies 514 4 digit 6101 (Kabupaten Sambas)
Kecamatan districts 7.285 6 digit 610105 (Pemangkat)
Desa/Kelurahan villages 83.762 10 digit 6101052001 (Pemangkat Kota)

Setiap ID diawali ID induknya, misalnya kecamatan 610105 berada di kabupaten 6101, yang berada di provinsi 61.

Versi yang Didukung

Laravel Versi IndoRegion Instalasi
11, 12 & 13 4.x composer require azishapidin/indoregion
8 3.x composer require azishapidin/indoregion:^3.0
6 & 7 2.2.2 composer require azishapidin/indoregion:2.2.2

Versi 4.x membutuhkan PHP 8.2 - 8.5, mengikuti versi PHP yang didukung masing-masing versi Laravel (Laravel 11: PHP 8.2 - 8.4, Laravel 12: PHP 8.2 - 8.5, Laravel 13: PHP 8.3 - 8.5). Database yang diuji: MySQL, PostgreSQL, dan SQLite.

Laravel 11 sudah tidak mendapat security patch. Kami sarankan upgrade ke Laravel 12 atau 13.

Instalasi

1. Install Package

Service provider terdaftar otomatis lewat Package Auto Discovery.

2. Publish File

Perintah di atas menyalin file-file berikut ke project Anda:

File Dari Ke
Migration vendor/azishapidin/indoregion/src/database/migrations database/migrations
Seeder vendor/azishapidin/indoregion/src/database/seeders database/seeders
Model vendor/azishapidin/indoregion/src/database/models app/Models

File dengan nama yang sama akan ditimpa.

3. Migrate dan Seed

Anda juga bisa mengimpor data per level, dengan urutan dari Provinsi sampai Desa/Kelurahan:

Struktur Tabel

Tabel Kolom
provinces id char(2) primary key, name
regencies id char(4) primary key, province_id char(2), name
districts id char(6) primary key, regency_id char(4), name
villages id char(10) primary key, district_id char(6), name

Semua ID bertipe string, jadi gunakan string saat mencari data, misalnya Province::find('61'), bukan Province::find(61). Nama wilayah disimpan dalam huruf kapital.

Penggunaan Dasar

Model yang sudah di-publish bisa digunakan seperti model Eloquent pada umumnya.

Penggunaan Lanjutan

Relasi

Cek Kecamatan di Provinsi

Cek Desa/Kelurahan di Kabupaten/Kota

Cek Wilayah Induk

Upgrade dari 3.x ke 4.x

Versi 4 membutuhkan Laravel 11 ke atas dan PHP 8.2 ke atas.

Penting: versi 4 menggunakan data dan format kode Kemendagri, menggantikan kode BPS di versi 3. Jika tabel Anda sendiri menyimpan ID wilayah (misalnya village_id di tabel users), ID tersebut perlu dimigrasikan sebelum Anda mengimpor ulang data:

  • Hampir semua ID kecamatan dan desa/kelurahan berubah, contohnya kecamatan 1101010 menjadi 110101.
  • Ada 4 provinsi baru hasil pemekaran Papua, dan kode provinsi Papua berubah: Papua 94 menjadi 91, Papua Barat 91 menjadi 92, dan kode 94 sekarang dipakai Papua Tengah. Kabupaten di wilayah tersebut ikut berpindah kode provinsi.

Struktur tabel juga berubah: kolom id sekarang menjadi primary key (sebelumnya hanya index, sehingga migration gagal di PostgreSQL dan MySQL 8.4), dan kolom ID kecamatan berubah dari char(7) menjadi char(6). Karena itu tabel wilayah perlu dibuat ulang.

  1. Migrasikan atau hapus dulu foreign key dari tabel Anda sendiri yang merujuk ke tabel wilayah. Tabel wilayah tidak bisa dihapus selama masih dirujuk foreign key.

  2. Update package:

  3. Publish ulang file migration, seeder, dan model:

  4. Hapus tabel wilayah lama dengan me-rollback 4 migration IndoRegion saja. Migration lain di project Anda tidak ikut di-rollback dan akan ditampilkan sebagai "Migration not found":

  5. Buat ulang tabel dan impor data baru:

Testing

Kontribusi

Kontribusi sangat terbuka. Silakan buat issue atau pull request di GitHub. Untuk perubahan data, pastikan semua test lolos sebelum mengirim pull request.

Lisensi

Package ini dirilis di bawah lisensi MIT.


All versions of indoregion with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
parsecsv/php-parsecsv Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package azishapidin/indoregion contains the following files

Loading the files please wait ...