PHPackages                             kjmtrue/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kjmtrue/vietnam-zone

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kjmtrue/vietnam-zone
====================

VietNam Zone

v1.0.5(4y ago)3115.5k↑192.9%16[1 issues](https://github.com/kjmtrue/vietnam-zone/issues)MITPHPCI failing

Since Jun 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/kjmtrue/vietnam-zone)[ Packagist](https://packagist.org/packages/kjmtrue/vietnam-zone)[ RSS](/packages/kjmtrue-vietnam-zone/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (7)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](https://danhmuchanhchinh.gso.gov.vn/).

Cập nhật lần cuối: 11/04/2022

1. Cài đặt
----------

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

#### 1.1 Cài đặt gói bằng composer

[](#11-cài-đặt-gói-bằng-composer)

```
composer require kjmtrue/vietnam-zone
```

#### 1.2 Copy file migration

[](#12-copy-file-migration)

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

#### 1.3 Chỉnh sửa file migration nếu cần

[](#13-chỉnh-sửa-file-migration-nếu-cần)

Mở các file migration sau và tuỳ chỉnh theo yêu cầu riêng của bạn.

```
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
```

2. Chạy migration
-----------------

[](#2-chạy-migration)

```
php artisan migrate
```

3. Import dữ liệu
-----------------

[](#3-import-dữ-liệu)

```
php artisan vietnamzone:import
```

Lưu ý:

- Dữ liệu được cập nhật lần cuối: 11/04/2022
- Để cập nhật dữ liệu mới nhất, vui lòng làm theo hướng dẫn ở mục 5 trước khi chạy lệnh `php artisan vietnamzone:import`

4. Sử dụng
----------

[](#4-sử-dụng)

```
$provinces = \Kjmtrue\VietnamZone\Models\Province::get();
$districts = \Kjmtrue\VietnamZone\Models\District::whereProvinceId(50)->get();
$wards = \Kjmtrue\VietnamZone\Models\Ward::whereDistrictId(552)->get();
```

5. Tải file dữ liệu
-------------------

[](#5-tải-file-dữ-liệu)

Dữ liệu được lấy từ [Tổng Cục Thống Kê Việt Nam](https://danhmuchanhchinh.gso.gov.vn/).

Trong tương lai, khi cơ quan có thẩm quyền sắp xếp lại các đơn vị hành chính thì bạn cần phải tải file dữ liệu mới nhất trước khi import dữ liệu vào dự án của bạn.

Bạn vui lòng làm theo các bước hướng dẫn dưới đây:

- Truy cập:  (URL này có thể bị [GSOVN](https://www.gso.gov.vn/) thay đổi)
- Tìm nút "Xuất Excel"
- Tick vào ô checkbox "Quận Huyện Phường Xã"
- Click vào nút "Xuất Excel", và tải file xls về
- Đổi tên file vừa tải về thành `vnzone.xls` và copy vào thư mục `storage` của dự án
- Chạy lệnh `php artisan vietnamzone:import` ở bước 3

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

36

—

LowBetter than 79% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~133 days

Recently: every ~84 days

Total

6

Last Release

1546d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k39](/packages/neuron-core-neuron-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)

PHPackages © 2026

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