承接 zaidysf/idn-area-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zaidysf/idn-area-laravel

Composer 安装命令:

composer require zaidysf/idn-area-laravel

包简介

Clean Indonesian Area Data Package for Laravel - Provinces, Regencies, Districts, Villages with curated official data

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Clean and fast Indonesian administrative area data package for Laravel. Get provinces, regencies, districts, and villages with curated official data.

✨ Features

  • 🌐 API Mode (Recommended) - Always up-to-date data via DataToko service
  • 🚀 Fast Local Mode - No API calls, works offline
  • 🧹 Clean Data - Curated and validated from official sources
  • 🔍 Search & Filter - Advanced search capabilities
  • 📦 Easy Setup - Simple artisan commands
  • Laravel 10/11/12 - Full compatibility
  • 🧪 100% Tested - 186 passing tests

📊 Data Coverage

Type Count Source
Provinces 38 Official Indonesian Government
Regencies 514+ Curated from BPS Data
Districts 7,292+ Updated Regularly
Villages 84,345+ Complete Coverage

🚀 Installation

composer require zaidysf/idn-area-laravel

⚡ Quick Setup

🌐 API Mode (Recommended)

Get always up-to-date data directly from official sources via DataToko service:

# Setup with API mode for real-time data
php artisan idn-area:setup --mode=api

Why API Mode?

  • Always Current - Real-time data from official government sources
  • No Maintenance - We handle all data updates automatically
  • Accurate - Direct from BPS (Indonesian Central Statistics Agency)
  • Reliable - Enterprise-grade DataToko infrastructure

🚀 Local Mode (Offline)

For applications that need offline capability:

# Setup with local mode (uses curated CSV files)
php artisan idn-area:setup --mode=local

💡 Usage

🏛️ Provinces

use zaidysf\IdnArea\Facades\IdnArea;

// Get all provinces
$provinces = IdnArea::getProvinces();
// Returns: [['code' => '11', 'name' => 'ACEH'], ...]

// Find specific province
$province = IdnArea::findProvince('11');
// Returns: ['code' => '11', 'name' => 'ACEH']

// Search provinces by name
$results = IdnArea::searchProvinces('jawa');
// Returns: [['code' => '32', 'name' => 'JAWA BARAT'], ...]

// Check if province exists
$exists = IdnArea::hasProvince('11'); // true

🏢 Regencies

// Get all regencies in a province
$regencies = IdnArea::getRegencies('11'); // Aceh regencies
// Returns: [['code' => '1101', 'province_code' => '11', 'name' => 'SIMEULUE'], ...]

// Find specific regency
$regency = IdnArea::findRegency('1101');
// Returns: ['code' => '1101', 'province_code' => '11', 'name' => 'SIMEULUE']

// Search regencies in specific province
$results = IdnArea::searchRegencies('bandung', '32');
// Returns regencies containing 'bandung' in West Java

// Search regencies across all provinces
$allResults = IdnArea::searchRegencies('bandung');

// Check if regency exists
$exists = IdnArea::hasRegency('1101'); // true

🏘️ Districts

// Get all districts in a regency
$districts = IdnArea::getDistricts('1101'); // Simeulue districts  
// Returns: [['code' => '110101', 'regency_code' => '1101', 'name' => 'TEUPAH SELATAN'], ...]

// Find specific district
$district = IdnArea::findDistrict('110101');
// Returns: ['code' => '110101', 'regency_code' => '1101', 'name' => 'TEUPAH SELATAN']

// Search districts in specific regency
$results = IdnArea::searchDistricts('selatan', '1101');

// Search districts across all regencies
$allResults = IdnArea::searchDistricts('selatan');

// Check if district exists
$exists = IdnArea::hasDistrict('110101'); // true

🏡 Villages

// Get all villages in a district
$villages = IdnArea::getVillages('110101'); // Teupah Selatan villages
// Returns: [['code' => '1101012001', 'district_code' => '110101', 'name' => 'LATIUNG'], ...]

// Find specific village
$village = IdnArea::findVillage('1101012001');
// Returns: ['code' => '1101012001', 'district_code' => '110101', 'name' => 'LATIUNG']

// Search villages in specific district
$results = IdnArea::searchVillages('latiung', '110101');

// Search villages across all districts
$allResults = IdnArea::searchVillages('latiung');

// Check if village exists
$exists = IdnArea::hasVillage('1101012001'); // true

🔍 Advanced Search & Utilities

// Get complete hierarchy (province with all children)
$hierarchy = IdnArea::getHierarchy('11'); 
// Returns province with regencies, districts, and villages

// Get multiple areas by codes
$areas = IdnArea::getMultipleByCode(['11', '12', '13']);
// Returns array of provinces with specified codes

// Get statistics
$stats = IdnArea::getStatistics();
// Returns: ['provinces' => 38, 'regencies' => 514, 'districts' => 7292, 'villages' => 84345]

// Get all data (use with caution - large dataset)
$allData = IdnArea::getAllData();

Using Models Directly

use zaidysf\IdnArea\Models\Province;
use zaidysf\IdnArea\Models\Regency;

// Eloquent relationships
$province = Province::with('regencies')->find('11');
$regencyCount = $province->regencies->count();

// Search with scopes
$searchResults = Province::search('jawa')->get();

🔧 Configuration

Publish the config file:

php artisan vendor:publish --tag="idn-area-config"

🌐 API Mode (Recommended for Production)

// config/idn-area.php
'mode' => 'api',
'datatoko_api' => [
    'base_url' => env('IDN_AREA_DATATOKO_URL', 'https://data.toko.center'),
    'access_key' => env('IDN_AREA_ACCESS_KEY'),
    'secret_key' => env('IDN_AREA_SECRET_KEY'),
],

Add to your .env:

IDN_AREA_MODE=api
IDN_AREA_ACCESS_KEY=your_access_key
IDN_AREA_SECRET_KEY=your_secret_key

Get API Keys: Contact DataToko for enterprise-grade API access with guaranteed uptime and real-time data updates.

🚀 Local Mode (Development/Offline)

// config/idn-area.php
'mode' => 'local', // Uses curated CSV files

🎛️ Artisan Commands

# Initial setup
php artisan idn-area:setup

# Switch between modes
php artisan idn-area:switch-mode api
php artisan idn-area:switch-mode local

# View package info
php artisan idn-area

# View statistics  
php artisan idn-area:stats

# Cache management
php artisan idn-area:cache warm
php artisan idn-area:cache clear

🧪 Testing

composer test

📈 Changelog

Please see CHANGELOG for more information on what has changed recently.

🤝 Contributing

Please see CONTRIBUTING for details.

🔒 Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

📄 Credits

📝 License

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

🇮🇩 About Indonesian Data

This package provides official Indonesian administrative area data sourced from government databases. The data is curated and regularly updated to ensure accuracy and completeness.

Data Sources:

  • Badan Pusat Statistik (BPS) - Indonesian Central Statistics Agency
  • Official Government Administrative Records
  • Validated and cleaned for consistency

Use Cases:

  • E-commerce shipping forms
  • Government applications
  • Data analysis and reporting
  • Location-based services
  • Administrative systems

zaidysf/idn-area-laravel 适用场景与选型建议

zaidysf/idn-area-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「clean」 「area」 「Enhanced」 「modern」 「indonesia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zaidysf/idn-area-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zaidysf/idn-area-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 zaidysf/idn-area-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-10