PHPackages                             abe/chinese-regions-for-laravel - 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. abe/chinese-regions-for-laravel

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

abe/chinese-regions-for-laravel
===============================

中国行政区划

v0.3.0(2y ago)11[3 PRs](https://github.com/abrahamgreyson/chinese-regions-for-laravel/pulls)MITPHPPHP ^8.0CI passing

Since Jan 2Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/abrahamgreyson/chinese-regions-for-laravel)[ Packagist](https://packagist.org/packages/abe/chinese-regions-for-laravel)[ Docs](https://github.com/abe/chinese-regions-for-laravel)[ RSS](/packages/abe-chinese-regions-for-laravel/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (16)Versions (7)Used By (0)

Laravel 中国行政区划
==============

[](#laravel-中国行政区划)

[![Latest Version on Packagist](https://camo.githubusercontent.com/41882f86547814ea7b0804d1a9f6e53389109f0701d84fc7a939e6cfde82654f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6162652f6368696e6573652d726567696f6e732d666f722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abe/chinese-regions-for-laravel)[![Total Downloads](https://camo.githubusercontent.com/4b79166ba73b511bc6abc141245ab8375198e582263aa2eb40725804b4a0dc9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6162652f6368696e6573652d726567696f6e732d666f722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abe/chinese-regions-for-laravel)[![tests](https://github.com/abrahamgreyson/chinese-regions-for-laravel/actions/workflows/run-tests.yml/badge.svg)](https://github.com/abrahamgreyson/chinese-regions-for-laravel/actions/workflows/run-tests.yml)[![Coverage](https://github.com/abrahamgreyson/chinese-regions-for-laravel/raw/coverage-badge/coverage.svg)](https://github.com/abrahamgreyson/chinese-regions-for-laravel/actions/workflows/tests.yml)

数据来源
----

[](#数据来源)

> - [中华人民共和国国家统计局-统计用区划和城乡划分代码](http://www.stats.gov.cn/sj/tjbz/qhdm/)
> - [中华人民共和国国家统计局-统计用区划代码和城乡划分代码编制规则](http://www.stats.gov.cn/sj/tjbz/gjtjbz/202302/t20230213_1902741.html)
> - 项目更新至: [2023年统计用区划代码和城乡划分代码（截止时间：2023-06-30，发布时间：2023-09-11）](http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2023/index.html)
> - 数据源作者:
> - 数据量约为 60 万条, 请耐心等待导入完成

安装
--

[](#安装)

##### 先决条件

[](#先决条件)

- ext\_pdo\_sqlite 我们需要读取数据源的 SQLite 文件导入到自己的数据库中,一旦导入完成就可以禁用扩展

然后通过 Composer 安装:

```
composer require abe/chinese-regions-for-laravel
```

安装后,运行数据库迁移命令,以创建数据表

```
php artisan migrate
```

数据表创建完成后,执行导入命令,导入数据

```
php artisan chinese-regions:import
```

使用
--

[](#使用)

我附带了一个简单的实体类, 你也可以自己实现

```
$chineseRegion = new \Abe\ChineseRegionsForLaravel\ChineseRegion();
/** @var \Illuminate\Database\Eloquent\Collection $provinces */
$provinces = $chineseRegion->provinces; // 所有省份
/** @var \Illuminate\Database\Eloquent\Collection $cities */
$cities = $provinces->first()->cities; // 获取第一个省份的所有城市
/** @var \Illuminate\Database\Eloquent\Collection $areas */
$areas = $cities->first()->areas; // 获取第一个城市的所有区县
/** @var \Illuminate\Database\Eloquent\Collection $streets */
$streets = $areas->first()->streets; // 获取第一个区县的所有街道
/** @var \Illuminate\Database\Eloquent\Collection $villages */
$villages = $streets->first()->towns; // 获取第一个街道的所有乡镇
/** @var \Illuminate\Database\Eloquent\Collection $street */
$street = $villages->parent; // 获取上级
** @var \Illuminate\Database\Eloquent\Collection $villages */
$villages = $street->children; // 获取**下一级**

// 请注意,我们只支持一级下级,平均每个省份有 2 万个村,我不认为有必要返回多级,你可以多次请求接口,或者自行实现
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [abraham greyson](https://github.com/abrahamgreyson)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance48

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~4 days

Total

3

Last Release

907d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1341308?v=4)[刘阳](/maintainers/abrahamgreyson)[@abrahamgreyson](https://github.com/abrahamgreyson)

---

Top Contributors

[![abrahamgreyson](https://avatars.githubusercontent.com/u/1341308?v=4)](https://github.com/abrahamgreyson "abrahamgreyson (80 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")

---

Tags

laravelabechinese regions

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/abe-chinese-regions-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/abe-chinese-regions-for-laravel/health.svg)](https://phpackages.com/packages/abe-chinese-regions-for-laravel)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M203](/packages/laravel-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1563.2k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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