Laravel Postcode ID
Laravel package for downloading and seeding Indonesian address data with postal codes.
Overview
Laravel Postcode ID provides a complete solution for managing Indonesian administrative geography data. It downloads data directly from the official Pos Indonesia website and seeds your database with provinces, regencies, districts, and villages — including postal codes.
Features
| Feature | Description |
|---|---|
| Auto Download | Fetches latest data from Pos Indonesia with retry & timeout handling |
| Hierarchical Parsing | Province → Regency → District → Village with name normalization |
| Database Seeders | Ready-to-use seeders with idempotent operations |
| Migrations | Auto-loaded, publishable migration files |
| Configurable Models | Extend default models or use your own |
| Multi-version | Supports Laravel 11, 12, and 13 |
Quick Example
use Ajangsupardi\PostcodeId\Models\Village;
// Find village by postal code with full hierarchy
$village = Village::with('district.regency.province')
->where('postal_code', '60111')
->first();
// Result: Gubeng, Kota Surabaya, Jawa Timur
Data Coverage
Requirements: PHP ^8.3 and Laravel ^11.0 / ^12.0 / ^13.0
| Level | Count | Description |
|---|---|---|
| Provinces | 38 | All Indonesian provinces |
| Regencies | 500+ | Cities (Kota) and regencies (Kabupaten) |
| Districts | 7,000+ | Sub-districts (Kecamatan) |
| Villages | 85,000+ | Villages (Desa/Kelurahan) with postal codes |
Data count may vary as it is synced directly from Pos Indonesia.