PHPackages                             xu42/china-same-name - 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. xu42/china-same-name

ActiveLibrary

xu42/china-same-name
====================

china same name query

0.0.2(7y ago)42234MITPHP

Since Jul 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/xu42/china-same-name)[ Packagist](https://packagist.org/packages/xu42/china-same-name)[ RSS](/packages/xu42-china-same-name/feed)WikiDiscussions master Synced yesterday

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

china-same-name
===============

[](#china-same-name)

🇨🇳中国同名同姓查询

Install
-------

[](#install)

Via Composer

```
$ composer require xu42/china-same-name
```

Usage
-----

[](#usage)

⚠️注意: 目前已支持河南、浙江全省及其各市查询.

```
require_once 'vendor/autoload.php';

// 查询在北京与张伟同名的人数
$count = \Xu42\ChinaSameName\ChinaSameName::count('张伟', 'beijing');

// 查询在河南全省与张伟同名的人数
$count = \Xu42\ChinaSameName\ChinaSameName::count('张伟', 'henan');

// 查询在河南郑州与张伟同名的人数
$count = \Xu42\ChinaSameName\ChinaSameName::count('张伟', 'henan.zhengzhou');

var_dump($count);
```

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

[](#contributing)

1. Fork me
2. 参考 [henan.default](https://github.com/xu42/china_same_name/blob/86980484c6c4aa2d0c0aba1662c445f87b0ef2c9/src/AreaConfig.php#L13-L20) , 补充完善 例如要添加台湾省的配置，需按照下列格式进行补充

```
const CONFIG = [
    'henan' => [
        ... //此处配置省略
    ],
    'taiwang' => [
        // common 为本省一些通用的配置, 例如method\key\pattern等,优先级低于具体地级市配置
        'common' => [
            'method' => 'get',
            'key' => 'data.count',
        ],
        // default 为全省的统计
        'default' => [
            'method' => 'get', //get or post
            'url' => 'https://people.gov.cn/count.json?name=@NAME@', // @NAME@会被替换为URL编码后的姓名 (post暂不支持)
            'key' => 'data.count', //对于接口返回是Json格式的,可以通过此字段进行提取 {'data':{'count':123}}
            'pattern' => '#all(\d+)people#', //对于接口返回非Json格式的文本的,可以通过正则匹配进行提取(暂不支持 欢迎提交PR或后续有需求再加)
            'params' => [], //method=post时的参数 (post暂不支持)
        ],
        // 台北市统计
        'taibei' => [
            ... //此处配置省略
        ],
    ],
    ... //此处配置省略
];
```

3. Pull Request

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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

Every ~0 days

Total

2

Last Release

2858d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12060792?v=4)[xu42](/maintainers/xu42)[@xu42](https://github.com/xu42)

---

Top Contributors

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

---

Tags

chinasame-names

### Embed Badge

![Health badge](/badges/xu42-china-same-name/health.svg)

```
[![Health](https://phpackages.com/badges/xu42-china-same-name/health.svg)](https://phpackages.com/packages/xu42-china-same-name)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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