PHPackages                             haydenzhou/laravel-china-cities - 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. haydenzhou/laravel-china-cities

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

haydenzhou/laravel-china-cities
===============================

create cities database with datas imported from Ministry of Civil Affairs of the People's Republic of China

v1.0.0(7y ago)5172PHP

Since Apr 3Pushed 7y agoCompare

[ Source](https://github.com/haydenzhourepo/laravel-china-cities)[ Packagist](https://packagist.org/packages/haydenzhou/laravel-china-cities)[ RSS](/packages/haydenzhou-laravel-china-cities/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

中国城市区划
------

[](#中国城市区划)

### feature

[](#feature)

1. 根据中华人民共和国民政部的提供的行政区划代码 创建项目的城市表
2. 提供一些封装的方法

### 使用

[](#使用)

发布migration文件 并填充数据

```
artisan vendor:publish --provider="HaydenZhou\LaravelChinaCities\LaravelChinaCitiesServiceProvider"

```

```
php artisan migrate

php artisan city:seed

```

创建City model

```
php artisan make:model City -c

```

City model 中 使用 CityTrait

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use HaydenZhou\LaravelChinaCities\CityTrait;

class City extends Model
{
    use CityTrait;

    public $timestamps = false;

    protected $primaryKey = 'code';

    protected $fillable = ['code', 'name', 'parent_code'];

    public function getRouteKeyName()
    {
        return 'code';
    }

}

```

### trait 方法

[](#trait-方法)

parent 父级城市

children 子城市

待完善...

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Unknown

Total

1

Last Release

2647d ago

### Community

Maintainers

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

---

Top Contributors

[![haydenzhourepo](https://avatars.githubusercontent.com/u/21101605?v=4)](https://github.com/haydenzhourepo "haydenzhourepo (6 commits)")

### Embed Badge

![Health badge](/badges/haydenzhou-laravel-china-cities/health.svg)

```
[![Health](https://phpackages.com/badges/haydenzhou-laravel-china-cities/health.svg)](https://phpackages.com/packages/haydenzhou-laravel-china-cities)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M117](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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