PHPackages                             lybc/php-gb2260 - 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. lybc/php-gb2260

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

lybc/php-gb2260
===============

v1.0.2(8y ago)451.9k9MITPHP

Since Sep 16Pushed 7y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)Used By (0)

php-gb2260
==========

[](#php-gb2260)

中华人民共和国国家标准 GB/T 2260 行政区划代码 php 封装

Installing
----------

[](#installing)

`composer require lybc/php-gb2260`

Usage
-----

[](#usage)

```
use Lybc\PhpGB2260\GB2260;

$provinceAreaCode = 360000; // 江西省
$cityAreaCode = 360300;     // 萍乡市
$districtAreaCode = 360313; // 湘东区

// 判断 code 是否省市区
GB2260::areaCode($provinceAreaCode)->isProvince();
GB2260::areaCode($provinceAreaCode)->isCity();
GB2260::areaCode($provinceAreaCode)->isDistrict();

// 根据 code 获取省市区名称
GB2260::areaCode(360313)->getCurrent(); // 获取当前代码的名称
GB2260::areaCode(360300)->getProvince(); // 根据市号获取所在省的名称
GB2260::areaCode(360313)->getCity(); // 根据区号获取所在市的名称
GB2260::areaCode(360313)->getDistrict(); // 根据区号获取名称

GB2260::areaCode(360300)->getDistrict(); // 根据市号获取所有区的名称，为 code => name 的数组

// 按照自定义格式输出
GB2260::areaCode(360300)->format('{p}, {c}, {d}'); // 输出江西省, 萍乡市, 湘东区, 只支持{p}/{c}/{d}

$area = new GB2260(360300); // 等价于 GB2260::areaCode(360300)
```

采集 China GB2260 数据
------------------

[](#采集-china-gb2260-数据)

```
php ./scripts/cn.php 地址
```

> 地址例如 则采集命令为 `php ./scripts/cn.php http://www.mca.gov.cn/article/sj/tjbz/a/2017/201707/201708241433.html`

License
-------

[](#license)

MIT

Thanks
------

[](#thanks)

[package-builder @ overtrue](https://github.com/overtrue/package-builder)

[gb2260](https://github.com/cn/GB2260)

[gb2260.php](https://github.com/cn/GB2260.php)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~1 days

Total

3

Last Release

3160d ago

### Community

Maintainers

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

---

Top Contributors

[![lybc](https://avatars.githubusercontent.com/u/9601872?v=4)](https://github.com/lybc "lybc (8 commits)")[![medz](https://avatars.githubusercontent.com/u/5564821?v=4)](https://github.com/medz "medz (2 commits)")[![Yangwendaxia](https://avatars.githubusercontent.com/u/3424048?v=4)](https://github.com/Yangwendaxia "Yangwendaxia (1 commits)")

---

Tags

china-administrative-divisiongb2260php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lybc-php-gb2260/health.svg)

```
[![Health](https://phpackages.com/badges/lybc-php-gb2260/health.svg)](https://phpackages.com/packages/lybc-php-gb2260)
```

###  Alternatives

[glicer/link-checker

Check broken links in html files, sitemap.xml and robots.txt

3113.7k](/packages/glicer-link-checker)

PHPackages © 2026

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