PHPackages                             ngoctuanit07/vietnam-boundaries - 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. [Database &amp; ORM](/categories/database)
4. /
5. ngoctuanit07/vietnam-boundaries

ActiveLibrary[Database &amp; ORM](/categories/database)

ngoctuanit07/vietnam-boundaries
===============================

Vietnam's area database.

v1.0.1(5y ago)010MITPHPPHP ^7.2|^8.0

Since Dec 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ngoctuanit07/vietnam-boundaries)[ Packagist](https://packagist.org/packages/ngoctuanit07/vietnam-boundaries)[ Docs](https://github.com/ngoctuanit07/vietnam-boundaries)[ RSS](/packages/ngoctuanit07-vietnam-boundaries/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (3)Used By (0)

Vietnam Maps
------------

[](#vietnam-maps)

Database of Vietnam's area.

Data are taken directly from the General Statistics Office of Vietnam.

[![Latest Version on Packagist](https://camo.githubusercontent.com/0514d5c81fc3855ffb3fbe5db12c6b32bd0b9fe8f5037b2aecfc4ab49ae035be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5475616e4e677579656e2f766965746e616d2d6d6170732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/TuanNguyen/vietnam-maps)[![Total Downloads](https://camo.githubusercontent.com/353c2bd89ad55fac9198959f770fbec59c0d5def9ac699fe453c31b862f98390/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5475616e4e677579656e2f766965746e616d2d6d6170732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/TuanNguyen/vietnam-maps)

Install
-------

[](#install)

```
composer require ngoctuanit07/vietnam-boundaries
```

Extracting
----------

[](#extracting)

### Method 1:

[](#method-1)

Extract directly via command:

```
php artisan vietnam-map:install
```

### Method 2:

[](#method-2)

#### Copy file config và migration

[](#copy-file-config-và-migration)

```
php artisan vendor:publish --provider="TuanNguyen\VietnamMap\VietnamMapServiceProvider"
```

#### Customize config và migration

[](#customize-config-và-migration)

1. Rename table

Open file `config/vietnam-maps.php` and config:

```
'tables' => [
    'provinces' => 'provinces',
    'districts' => 'districts',
    'wards'     => 'wards',
],
```

2. Rename column

Open file `config/vietnam-maps.php` and config:

```
'columns' => [
    'name'        => 'name',
    'gso_id'      => 'gso_id',
    'province_id' => 'province_id',
    'district_id' => 'district_id',
],
```

3. Add column

Open the following migration files and customize if you need:

```
database/migrations/{datetime}_create_vietnam_maps_table.php
```

#### Run migration

[](#run-migration)

```
php artisan migrate
```

#### Download và import into database

[](#download-và-import-into-database)

```
php artisan vietnam-map:download
```

Usage with Models
-----------------

[](#usage-with-models)

1. Get all provinces, districts, wards

```
    use TuanNguyen\VietnamMap\Models\Province;
    use TuanNguyen\VietnamMap\Models\District;
    use TuanNguyen\VietnamMap\Models\Ward;

   class DevController extends Controller
   {
       ...
       public function dev()
       {
           $provinces = Province::all();
           $districts = District::all();
           $wards = Ward::all();
           ...
       }
   }
```

2. Get data using relationship

```
    use TuanNguyen\VietnamMap\Models\Province;

   class DevController extends Controller
   {
       ...
       public function dev()
       {
           $province = Province::first();
           $districts = $province->districts;
           ...
       }
   }
```

3. Relation in Province.php

```
    class Province extends Model
    {
        ...
        public function districts()
        {
            return $this->hasMany(District::class);
        }
    }
```

4. Relation in District.php

```
    class District extends Model
    {
        ...
        public function province()
        {
            return $this->belongsTo(Province::class, config('vietnam-maps.columns.province_id'), 'id');
        }

        public function wards()
        {
            return $this->hasMany(Ward::class);
        }
    }
```

5. Relation in Ward.php

```
    class Ward extends Model
    {
        ...
        public function district()
        {
            return $this->belongsTo(District::class, config('vietnam-maps.columns.district_id'), 'id');
        }
    }
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Phi Hoang](https://github.com/TuanNguyendev)
- [All Contributors](../../contributors)

References
----------

[](#references)

1. [General Statistics Office of Vietnam](https://www.gso.gov.vn/dmhc2015)
2. [Vietnam Zone](https://github.com/kjmtrue/vietnam-zone)

License
-------

[](#license)

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1981d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99696474a00f5715f0b6eb21bb535ab821ba8533e7ea609fa44a631e48d2b44d?d=identicon)[ngoctuanit07](/maintainers/ngoctuanit07)

---

Top Contributors

[![walternguyen07](https://avatars.githubusercontent.com/u/68157127?v=4)](https://github.com/walternguyen07 "walternguyen07 (2 commits)")

---

Tags

laravellaravel-packagevietnam-mapsvietnam-zonevietnam-databaselaravel-package-vietnamlaravel-vietnam-mapshanhchinhvietnamhcvnwalternguyen

### Embed Badge

![Health badge](/badges/ngoctuanit07-vietnam-boundaries/health.svg)

```
[![Health](https://phpackages.com/badges/ngoctuanit07-vietnam-boundaries/health.svg)](https://phpackages.com/packages/ngoctuanit07-vietnam-boundaries)
```

###  Alternatives

[hoangphi/vietnam-maps

Vietnam's area database.

144.4k](/packages/hoangphi-vietnam-maps)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[lwwcas/laravel-countries

A comprehensive package for managing country data in Laravel applications, including multilingual support, geographic coordinates, and detailed metadata for seamless integration with Laravel.

12464.0k](/packages/lwwcas-laravel-countries)[salehhashemi/laravel-repository

Implementing the repository pattern for Laravel projects.

2010.5k](/packages/salehhashemi-laravel-repository)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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