Download the PHP package meshell/ffi-pinyin without Composer

On this page you can find all versions of the php package meshell/ffi-pinyin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ffi-pinyin

ffi-pinyin

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

环境

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

还需要设置php.ini 中的ffi.enableOn

Usage

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

以上程序执行后的结果:

多音字是以:来连接的。

Benchmark

选用了比较流行的https://github.com/overtrue/pinyin 作为比较对象。

使用的测试命令:

使同等数据循环100次测试结果:

benchmark subject set revs iter mem_peak time_rev comp_z_value comp_deviation
Bench benchFFI 0 1 0 569,696b 2,007.000μs 0.00σ 0.00%
Bench benchNative 0 1 0 2,679,192b 128,229.000μs 0.00σ 0.00%
Bench benchNativeMemory 0 1 0 2,678,544b 91,516.000μs 0.00σ 0.00%
Bench benchNativeGenerator 0 1 0 632,680b 12,223,686.000μs 0.00σ 0.00%

相比之下与比较对象最快的也相差45倍的性能之差。

单次执行测试结果:

benchmark subject set revs iter mem_peak time_rev comp_z_value comp_deviation
Bench benchFFI 0 1 0 569,696b 1,599.000μs 0.00σ 0.00%
Bench benchNative 0 1 0 2,679,192b 19,783.000μs 0.00σ 0.00%
Bench benchNativeMemory 0 1 0 2,678,544b 21,160.000μs 0.00σ 0.00%
Bench benchNativeGenerator 0 1 0 632,680b 125,524.000μs 0.00σ 0.00%

相比之下与比较对象最快的差不多20倍的性能之差。

在线转换

FAQ


All versions of ffi-pinyin with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-ffi Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package meshell/ffi-pinyin contains the following files

Loading the files please wait ....