PHPackages                             turahe/master-data - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. turahe/master-data

ActiveLibrary

turahe/master-data
==================

Package Laravel yang berisi data Provinsi, Kabupaten/Kota, Kecamatan, dan Keluarahan/Desa di seluruh Master.

v1.1.1(10mo ago)09641[2 PRs](https://github.com/turahe/master-data/pulls)3MITPHPPHP ^8.2CI passing

Since Oct 27Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/turahe/master-data)[ Packagist](https://packagist.org/packages/turahe/master-data)[ RSS](/packages/turahe-master-data/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (6)Dependencies (8)Versions (19)Used By (3)

Laravel Master Data Package
===========================

[](#laravel-master-data-package)

[![Total Downloads](https://camo.githubusercontent.com/466f6553b4b742644f4f8e676a07ca1a642b8b5f1843cb10c9d409fedf173a74/68747470733a2f2f706f7365722e707567782e6f72672f7475726168652f6d61737465722d646174612f646f776e6c6f616473)](//packagist.org/packages/turahe/master-data)[![Version](https://camo.githubusercontent.com/23ab7f14011159bd9c1647df026cdb0915353a8f179a62c2a988ffed05802031/68747470733a2f2f706f7365722e707567782e6f72672f7475726168652f6d61737465722d646174612f76657273696f6e)](//packagist.org/packages/turahe/master-data)[![License](https://camo.githubusercontent.com/616711bd2966bb8f302f82c7ca1eb2abe4056404cdd6ac5bceefb47907ad6dd0/68747470733a2f2f706f7365722e707567782e6f72672f7475726168652f6d61737465722d646174612f6c6963656e7365)](//packagist.org/packages/turahe/master-data)[![Tests](https://github.com/turahe/master-data/workflows/Tests%20(Simple)/badge.svg)](https://github.com/turahe/master-data/actions/workflows/tests-simple.yml)[![Code Quality](https://github.com/turahe/master-data/workflows/Code%20Quality/badge.svg)](https://github.com/turahe/master-data/actions/workflows/code-quality.yml)

A comprehensive Laravel package that provides master data for countries, provinces, cities, districts, villages, banks, currencies, and languages. Perfect for applications requiring geographical data, banking information, and internationalization support.

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Usage](#-usage)
- [Data Overview](#-data-overview)
- [API Reference](#-api-reference)
- [Testing](#-testing)
- [Contributing](#-contributing)
- [License](#-license)

✨ Features
----------

[](#-features)

- **🌍 Geographical Data**: Complete hierarchy of countries, provinces, cities, districts, and villages
- **🏦 Banking Information**: Indonesian banks with codes, names, and company details
- **💱 Currency Support**: Global currencies with codes and symbols
- **🌐 Language Support**: International languages with ISO codes
- **🖼️ Visual Assets**: Country flags and city images included
- **🔍 Easy Querying**: Eloquent models with relationships and scopes
- **⚡ Performance**: Optimized database structure and caching
- **🧪 Comprehensive Testing**: Full test coverage across multiple PHP/Laravel versions

📋 Requirements
--------------

[](#-requirements)

- **PHP**: 8.2, 8.3, 8.4
- **Laravel**: 10.x, 11.x, 12.x
- **Database**: MySQL, PostgreSQL, SQLite (for testing)

🚀 Installation
--------------

[](#-installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require turahe/master-data
```

### 2. Publish Assets and Migrations

[](#2-publish-assets-and-migrations)

```
php artisan vendor:publish --provider="Turahe\Master\MasterServiceProvider" --tag=assets
```

### 3. Run Migrations

[](#3-run-migrations)

```
php artisan migrate
```

### 4. Seed the Database (Optional)

[](#4-seed-the-database-optional)

```
php artisan master:seed
```

⚙️ Configuration
----------------

[](#️-configuration)

The package configuration is published to `config/master.php`. You can customize table names and model classes:

```
return [
    'tables' => [
        'countries' => 'tm_countries',
        'provinces' => 'tm_provinces',
        'cities' => 'tm_cities',
        'districts' => 'tm_districts',
        'villages' => 'tm_villages',
        'banks' => 'tm_banks',
        'currencies' => 'tm_currencies',
        'languages' => 'tm_languages',
    ],
    'models' => [
        'country' => \Turahe\Master\Models\Country::class,
        'province' => \Turahe\Master\Models\Province::class,
        'city' => \Turahe\Master\Models\City::class,
        'district' => \Turahe\Master\Models\District::class,
        'village' => \Turahe\Master\Models\Village::class,
    ],
];
```

💡 Usage
-------

[](#-usage)

### Using Eloquent Models

[](#using-eloquent-models)

```
use Turahe\Master\Models\Country;
use Turahe\Master\Models\Province;
use Turahe\Master\Models\City;
use Turahe\Master\Models\Bank;
use Turahe\Master\Models\Currency;

// Get all countries
$countries = Country::all();

// Get Indonesia
$indonesia = Country::where('name', 'Indonesia')->first();

// Get provinces in Indonesia
$provinces = $indonesia->provinces;

// Get cities in a specific province
$jakarta = Province::where('name', 'DKI Jakarta')->first();
$cities = $jakarta->cities;

// Get banks
$banks = Bank::all();

// Get currencies
$currencies = Currency::all();
```

### Using the Facade

[](#using-the-facade)

```
use Turahe\Master\Master;

// Access models through facade
$countries = Master::country()->all();
$provinces = Master::province()->all();
$cities = Master::city()->all();
$banks = Master::bank()->all();
```

### Relationships

[](#relationships)

```
// Country -> Provinces
$country = Country::find(1);
$provinces = $country->provinces;

// Province -> Cities
$province = Province::find(1);
$cities = $province->cities;

// City -> Districts
$city = City::find(1);
$districts = $city->districts;

// District -> Villages
$district = District::find(1);
$villages = $district->villages;
```

### Search and Filter

[](#search-and-filter)

```
// Search cities by name
$cities = City::where('name', 'like', '%Jakarta%')->get();

// Get cities by province
$cities = City::where('province_id', $provinceId)->get();

// Get banks by code
$bank = Bank::where('code', '008')->first(); // Bank Mandiri
```

📊 Data Overview
---------------

[](#-data-overview)

This package provides comprehensive master data:

Data TypeCountDescription**Countries**266Global countries with ISO codes**Provinces**4,526Administrative divisions worldwide**Cities**7,376Cities and municipalities**Districts**81,153Districts and sub-districts**Villages**1,570Villages and neighborhoods**Banks**256Indonesian banks with codes**Currencies**423Global currencies with symbols**Languages**266International languages with ISO codes**Flags**1,570Country flag images**City Images**7,376City landmark images🔧 API Reference
---------------

[](#-api-reference)

### Models

[](#models)

#### Country

[](#country)

```
Country::all()                    // Get all countries
Country::find($id)               // Find by ID
Country::where('name', $name)    // Find by name
$country->provinces              // Get related provinces
```

#### Province

[](#province)

```
Province::all()                  // Get all provinces
Province::find($id)             // Find by ID
Province::where('country_id', $id) // Get by country
$province->cities               // Get related cities
$province->country              // Get parent country
```

#### City

[](#city)

```
City::all()                      // Get all cities
City::find($id)                 // Find by ID
City::where('province_id', $id)  // Get by province
$city->districts                // Get related districts
$city->province                 // Get parent province
```

#### Bank

[](#bank)

```
Bank::all()                      // Get all banks
Bank::where('code', $code)      // Find by bank code
Bank::where('name', $name)      // Find by bank name
```

#### Currency

[](#currency)

```
Currency::all()                  // Get all currencies
Currency::where('code', $code)  // Find by currency code
Currency::where('name', $name)  // Find by currency name
```

### Commands

[](#commands)

```
# Seed all master data
php artisan master:seed

# Sync coordinates (requires spatie/geocoder)
php artisan master:sync-coordinates
```

🧪 Testing
---------

[](#-testing)

This package is thoroughly tested against:

- **PHP**: 8.2, 8.3, 8.4
- **Laravel**: 10.x, 11.x, 12.x

### Running Tests Locally

[](#running-tests-locally)

```
# Install dependencies
composer install

# Run tests
vendor/bin/phpunit

# Run code quality checks
vendor/bin/pint --test
vendor/bin/phpstan analyse src tests --level=8
```

### Test Matrix

[](#test-matrix)

The CI/CD pipeline excludes incompatible combinations:

- Laravel 12.x requires PHP 8.3+
- Laravel 10.x doesn't support PHP 8.4

🤝 Contributing
--------------

[](#-contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

### Development Setup

[](#development-setup)

```
# Clone the repository
git clone https://github.com/turahe/master-data.git

# Install dependencies
composer install

# Run tests
vendor/bin/phpunit

# Check code style
vendor/bin/pint
```

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Data sources for geographical information
- Laravel community for the excellent framework
- Contributors and maintainers

---

**Made with ❤️ by [Nur Wachid](mailto:wachid@outlook.com)**

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance74

Regular maintenance activity

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 99% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~132 days

Recently: every ~78 days

Total

14

Last Release

303d ago

Major Versions

v0.1.7 → v1.0.02023-03-25

PHP version history (6 changes)0.0.1PHP &gt;=7.2.5

v0.0.3PHP ^7.4|^8.0

v0.1.5PHP ^8.0

v1.0.0PHP ^8.1

v1.0.1PHP ^8.3

v1.1.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3513bd6100438bcb8c6b1a7e241a66e1ddaf1c11ee33883e06ef4a2784120db?d=identicon)[turahe](/maintainers/turahe)

---

Top Contributors

[![turahe](https://avatars.githubusercontent.com/u/6832622?v=4)](https://github.com/turahe "turahe (96 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laraveladdressindonesiaprovinsikabupatenkecamatankelurahankotadesaturahealamat

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/turahe-master-data/health.svg)

```
[![Health](https://phpackages.com/badges/turahe-master-data/health.svg)](https://phpackages.com/packages/turahe-master-data)
```

###  Alternatives

[laravolt/indonesia

Package Laravel yang berisi data Provinsi, Kabupaten/Kota, Kecamatan, dan Keluarahan/Desa di seluruh Indonesia.

656189.8k1](/packages/laravolt-indonesia)[creasi/laravel-nusa

A Laravel package that aim to provide Indonesia' Administrative Data

987.2k1](/packages/creasi-laravel-nusa)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[nevadskiy/laravel-geonames

Populate your database using the GeoNames service.

2715.1k](/packages/nevadskiy-laravel-geonames)[afrizalmy/laraindo

Package Laravel 9 sederhana untuk format indonesia terdiri dari Localization, Rupiah format, Date format

215.3k3](/packages/afrizalmy-laraindo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
