PHPackages                             nguyenquang2302/vietnam-zone - 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. nguyenquang2302/vietnam-zone

ActiveLibrary

nguyenquang2302/vietnam-zone
============================

VietNam Zone

030PHP

Since Apr 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nguyenquang2302/vietnam-data)[ Packagist](https://packagist.org/packages/nguyenquang2302/vietnam-zone)[ RSS](/packages/nguyenquang2302-vietnam-zone/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

VietNam Zone
------------

[](#vietnam-zone)

Database đơn vị hành chính của Việt Nam

Dữ liệu được lấy trực tiếp từ Tổng Cục Thống Kê Việt Nam.

Đảm bảo luôn luôn là dữ liệu mới nhất và chính xác nhất.

Cài đặt
-------

[](#cài-đặt)

```
composer require nguyenquang2302/vietnam-zone
```

#### Copy file config và migration

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

```
php artisan vendor:publish --provider="nguyenquang2302\VietnamZone\ServiceProvider"
```

#### Chỉnh sửa config và migration nếu bạn cần tuỳ biến cho dự án

[](#chỉnh-sửa-config-và-migration-nếu-bạn-cần-tuỳ-biến-cho-dự-án)

1. Đổi tên bảng

Mở file `config/vietnam-zone.php` chỉnh các cấu hình sau:

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

2. Đổi tên column

Mở file `config/vietnam-zone.php` chỉnh các cấu hình sau:

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

3. Thêm column

Mở các file migration sau và tuỳ chỉnh theo ý thích

```
database/migrations/2020_01_01_000001_create_provinces_table.php
database/migrations/2020_01_01_000002_create_districts_table.php
database/migrations/2020_01_01_000003_create_wards_table.php
```

Run migration
-------------

[](#run-migration)

```
php artisan migrate
```

Download và import dữ liệu vào database
---------------------------------------

[](#download-và-import-dữ-liệu-vào-database)

```
php artisan vietnamzone:download
```

Todo
----

[](#todo)

- Cập nhật dữ liệu
- Download file trực tiếp từ website tổng cục thống kê

Screenshot
----------

[](#screenshot)

`select * from provinces`

```
+----+------------------------+--------+---------------------+---------------------+
| id | name                   | gso_id | created_at          | updated_at          |
+----+------------------------+--------+---------------------+---------------------+
|  1 | Thành phố Hà Nội       | 01     | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  2 | Tỉnh Hà Giang          | 02     | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  3 | Tỉnh Cao Bằng          | 04     | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  4 | Tỉnh Bắc Kạn           | 06     | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  5 | Tỉnh Tuyên Quang       | 08     | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
+----+------------------------+--------+---------------------+---------------------+

```

`select * from districts`

```
+----+-------------------+--------+-------------+---------------------+---------------------+
| id | name              | gso_id | province_id | created_at          | updated_at          |
+----+-------------------+--------+-------------+---------------------+---------------------+
|  1 | Quận Ba Đình      | 001    |           1 | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  2 | Quận Hoàn Kiếm    | 002    |           1 | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  3 | Quận Tây Hồ       | 003    |           1 | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  4 | Quận Long Biên    | 004    |           1 | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
|  5 | Quận Cầu Giấy     | 005    |           1 | 2020-06-16 17:22:30 | 2020-06-16 17:22:30 |
+----+-------------------+--------+-------------+---------------------+---------------------+

```

`select * from wards`

```
+----+--------------------------+--------+-------------+---------------------+---------------------+
| id | name                     | gso_id | district_id | created_at          | updated_at          |
+----+--------------------------+--------+-------------+---------------------+---------------------+
|  1 | Phường Phúc Xá           | 00001  |           1 | 2020-06-16 17:30:13 | 2020-06-16 17:30:13 |
|  2 | Phường Trúc Bạch         | 00004  |           1 | 2020-06-16 17:30:13 | 2020-06-16 17:30:13 |
|  3 | Phường Vĩnh Phúc         | 00006  |           1 | 2020-06-16 17:30:13 | 2020-06-16 17:30:13 |
|  4 | Phường Cống Vị           | 00007  |           1 | 2020-06-16 17:30:13 | 2020-06-16 17:30:13 |
|  5 | Phường Liễu Giai         | 00008  |           1 | 2020-06-16 17:30:13 | 2020-06-16 17:30:13 |
+----+--------------------------+--------+-------------+---------------------+---------------------+

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![kimtrien](https://avatars.githubusercontent.com/u/9027134?v=4)](https://github.com/kimtrien "kimtrien (5 commits)")

### Embed Badge

![Health badge](/badges/nguyenquang2302-vietnam-zone/health.svg)

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

PHPackages © 2026

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