PHPackages                             yuzhiwei/pinyin - 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. yuzhiwei/pinyin

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

yuzhiwei/pinyin
===============

解析中文的拼音

1.0.0(6y ago)036MITPHPPHP &gt;=7.1

Since May 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Daleyzw/pinyin)[ Packagist](https://packagist.org/packages/yuzhiwei/pinyin)[ RSS](/packages/yuzhiwei-pinyin/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

pinyin
======

[](#pinyin)

汉字转带有声调的汉语拼音，汉字转无声调的汉语拼音，汉字转成汉语拼音首字母，获取英文姓名首字母，获取中文名

#### Install

[](#install)

```
composer require yuzhiwei/pinyin

```

#### Example

[](#example)

```
//没有声调
$testStr = $pinyin->transformWithoutTone("你好，中国");

var_dump($testStr); //string(13) "nihaozhongguo"

//汉字首字母
$testStr1 = $pinyin->transformUcwords("中国");

var_dump($testStr1);  //string(2) "ZG"

$testStr1 = $pinyin->transformFirstUcwords("北京");

var_dump($testStr1);  //string(2) "B"

//有声调
$testStr2 = $pinyin->transformWithTone("你好，中国");

var_dump($testStr2);  //string(24) "nǐ hǎo ，zhōng guó "

//获取英文名首字母
$testStr3 = $pinyin->getFirstCharacter('peter pang');
var_dump($testStr3);  //string(2) "PP"

//获取中文名
$testStr4 = $pinyin->getFirstName("吴彦祖");
var_dump($testStr4);   //string(6) "彦祖"

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

2251d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/yuzhiwei-pinyin/health.svg)

```
[![Health](https://phpackages.com/badges/yuzhiwei-pinyin/health.svg)](https://phpackages.com/packages/yuzhiwei-pinyin)
```

###  Alternatives

[abei2017/yii2-wx

一个专注于yii2的微信sdk

1472.8k](/packages/abei2017-yii2-wx)

PHPackages © 2026

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