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

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

chineseboost/php-pinyin
=======================

Pinyin and hanzi tools in pure PHP | 纯PHP的汉语拼音和汉字工具

1.3.1(4y ago)92.1k↓82%MITPHPPHP &gt;=7.1CI failing

Since Apr 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chineseboost/php-pinyin)[ Packagist](https://packagist.org/packages/chineseboost/php-pinyin)[ RSS](/packages/chineseboost-php-pinyin/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (13)Used By (0)

PHP Pinyin
==========

[](#php-pinyin)

[![BuildStatus](https://camo.githubusercontent.com/49d8b9a5c9d3235c309c9dd438d0a1391f14324be8b7e795504c60c1f96f3835/68747470733a2f2f7472617669732d63692e6f72672f6368696e657365626f6f73742f7068702d70696e79696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chineseboost/php-pinyin)[![Coverage Status](https://camo.githubusercontent.com/cf6c48236a5f1f4bd454449a43477328e82659cae6dbbbfd7fdbf3ead8a2f3bb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6368696e657365626f6f73742f7068702d70696e79696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/chineseboost/php-pinyin?branch=master)[![StyleCI](https://camo.githubusercontent.com/4a31ad78c102767d1e5b1c85796ccd53d16d2d082f4c02ace5ec989ed34e6422/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233313232303138342f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/231220184)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Pinyin and hanzi tools in pure PHP | 纯PHP的汉语拼音和汉字工具

You can try a web version of this here:

Usage
-----

[](#usage)

Install via composer:

```
composer require chineseboost/php-pinyin
```

### Converting hanzi into pinyin

[](#converting-hanzi-into-pinyin)

You can convert hanzi strings into pinyin with a furthest-forward matching strategy.

php-pinyin handles a lot of cases that other pinyin generation tools do not, including many 多音字, 儿化 and common mis-parsings.

```
