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

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

meshell/ffi-pinyin
==================

Quickly convert Chinese to chinese pinyin

1.3.1(2y ago)29347MITPHPPHP &gt;=7.4

Since Jun 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/TianLiangZhou/ffi-pinyin)[ Packagist](https://packagist.org/packages/meshell/ffi-pinyin)[ RSS](/packages/meshell-ffi-pinyin/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (2)Versions (12)Used By (0)

ffi-pinyin
----------

[](#ffi-pinyin)

该项目是将中文汉字转换成拼音，使用`rust`构建动态链接库来给`php`调用。 该库主要是为了提高`php`中文转换拼音的性能问题而构建（**特别是长文章**）。

### 环境

[](#环境)

需要`php >= 7.4` 以上的版本并且开启了`FFI`扩展。如果你需要自己编译库还需要装`rust` 工具链。

还需要设置`php.ini` 中的`ffi.enable`为`On`。

### Usage

[](#usage)

该库提供四种基础用法：不带音标，带音标，首字母，多音字带音标。

```
