PHPackages                             hejunjie/china-division - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. hejunjie/china-division

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

hejunjie/china-division
=======================

定期更新，全国最新省市区划分数据，身份证号码解析地址，支持 Composer 安装与版本控制，适用于表单选项、数据校验、地址解析等场景 | Regularly updated dataset of China's administrative divisions with ID-card address parsing. Distributed via Composer and versioned for use in forms, validation, and address-related features

v1.0.5(6mo ago)31.5k↓44.4%2MITPHPPHP &gt;=7.0

Since Apr 12Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/zxc7563598/php-china-division)[ Packagist](https://packagist.org/packages/hejunjie/china-division)[ RSS](/packages/hejunjie-china-division/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (2)

hejunjie/china-division
=======================

[](#hejunjiechina-division)

 [English](./README.md)｜[简体中文](./README.zh-CN.md)---

Regularly updated dataset of China's administrative divisions with ID-card address parsing. Distributed via Composer and versioned for use in forms, validation, and address-related features

**This project has been parsed by Zread. If you need a quick overview of the project, you can click here to view it：[Understand this project](https://zread.ai/zxc7563598/php-china-division)**

---

This is a nationwide provincial, city, and district division data repository that I maintain, containing the latest administrative division data, as well as historical records and address changes. It's mainly to make it easier to access this data in projects without having to manually search and organize it every time.

The data is synchronized and updated periodically, supports installation via Composer, and can also be processed by directly referencing the JSON file.

If you don't want to deploy it and just want to use it, you can 👉 [click here to use it](https://hejunjie.life/composer/china-division).

It also supports bulk queries.

Installation
------------

[](#installation)

Install via Composer:

```
composer require hejunjie/china-division
```

Included Data Files
-------------------

[](#included-data-files)

`data.json`: The currently valid nationwide provincial, city, and district data.

`history.json`: Historical regional data (including areas that have been revoked, merged, or renamed).

`diff.json`: Records of administrative division changes (such as what changed from and to what).

You can directly import the JSON files for processing. The structure is clear and ready to use.

Usage
-----

[](#usage)

I wrote a simple helper class called `Division` to facilitate data retrieval and common processing:

```
