Download the PHP package dyangalih/laravel-regions without Composer
On this page you can find all versions of the php package dyangalih/laravel-regions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dyangalih/laravel-regions
More information about dyangalih/laravel-regions
Files in dyangalih/laravel-regions
Package laravel-regions
Short Description Indonesian region with official 2025 BPS & Kemendagri data
License MIT
Homepage https://github.com/DyanGalih/laravel-regions
Informations about the package laravel-regions
Laravel Indonesian Region API
A high-performance, governed Laravel package for Indonesian regional data (Provinces, Regencies, Districts, and Villages) using 2025 BPS & Kemendagri data. Featuring a deep hierarchical REST API, global search capabilities, and optimized data ingestion.
Requirements
- PHP:
^8.1(to match composer.json) - Laravel:
10.x,11.x,12.x, or13.x
Features
- Full Indonesian Hierarchy: Provinces → Regencies → Districts → Villages.
- Dual-Access API: Support for both deep hierarchical and flat global endpoints.
- Deep Eager Loading: Automatically includes full parent hierarchy without N+1 queries.
- High-Performance Seeding: Chunked data ingestion for high-volume datasets with automatic cache invalidation.
- Intelligent Caching: Permanent versioned caching for detail lookups with self-healing serialization recovery.
- Zero-Config Auto-Discovery: Works out of the box with standard Laravel commands.
Engineering Standards
This package was developed using an advanced AI-assisted engineering workflow to ensure production-grade stability:
- Spec-Kit: Orchestrated development from specification to implementation.
- Memory-Hub, Security-Review, and Architecture-Guard enforced.
Installation
Quick Start (Zero-Config)
API Documentation
All routes are prefixed with /api/region.
Hierarchical Endpoints
Used for drill-down UIs or strictly scoped data retrieval.
| Method | Endpoint | Description |
|---|---|---|
GET |
/provinces |
List all provinces |
GET |
/provinces/{id} |
Get province details |
GET |
/provinces/{pId}/regencies |
List regencies in a province |
GET |
/provinces/{pId}/regencies/{rId} |
Get regency details |
GET |
/provinces/{pId}/regencies/{rId}/districts |
List districts in a regency |
GET |
/provinces/{pId}/regencies/{rId}/districts/{dId}/villages |
List villages in a district |
Global Search & Detail Endpoints
Used for global search boxes, autocomplete, or direct ID lookups.
| Method | Endpoint | Description |
|---|---|---|
GET |
/regencies |
Global search regencies |
GET |
/regencies/{id} |
Get regency detail globally |
GET |
/districts |
Global search districts |
GET |
/districts/{id} |
Get district detail globally |
GET |
/villages |
Global search villages |
GET |
/villages/{id} |
Get village detail globally |
Example JSON Response
When requesting a village (either globally or hierarchically), you get the full parent context:
Programmatic Usage
You can interact with the regional data directly in your PHP code using the Facade or Service.
Using the Facade
The Region facade provides a clean, expressive syntax for data retrieval.
Dependency Injection
You can also inject the RegionService into your controllers or services.
Performance & Caching
The package implements an Intelligent Caching layer designed for static regional data.
Forever Caching
All detail and ID-based lookups (get*ById, get*Detail) are cached forever by default. This ensures near-zero latency for repeated requests.
Self-Healing Resilience
To prevent crashes in unstable serialization environments (e.g., PHP 8.4 drift), the package automatically detects and purges corrupted cache entries (like __PHP_Incomplete_Class), re-generating them on the fly.
Cache Invalidation
The cache is versioned (region.v{version}.*). When you update your regional data, you must increment the version to invalidate all existing cache.
Manual Flush:
Automatic Flush:
The php artisan indonesia:seed command automatically triggers a cache flush upon successful completion.
Contributing
Please see CONTRIBUTING for details.
Credits
- wilayah_indonesia: The primary source for the Indonesian regional CSV data (2025 BPS & Kemendagri).
- Spec-Kit: The engineering framework used for governed development.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-regions with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-data Version ^3.0|^4.0