Download the PHP package yurunsoft/chinese-util without Composer

On this page you can find all versions of the php package yurunsoft/chinese-util. 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 chinese-util

ChineseUtil

PHP 中文工具包,支持汉字转拼音、拼音分词、简繁互转、数字转换、金额数字转换。

由于中文的博大精深,字有多音字,简体字和繁体字也有多种对应。并且本类库返回的所有结果,均为包含所有组合的数组。

本类库字典数据总共收录 73925 个汉字,包括:3955 个简体字,1761 个繁体字,68209 个其它汉字。

模式

性能模式 (Memory)

使用 SQLite 作为数据载体,一次性加载所有数据到变量,内存占用高(80+ MB),性能最佳。

适合用于运行 Cli 任务。

需要 PDO 和 PDO_SQLITE 扩展支持。

通用模式 (SQLite)

使用 SQLite 作为数据载体,每次查询都通过 SQL 查询,内存占用低(100-200 KB),性能中等。

适合用于大部分场景。

需要 PDO 和 PDO_SQLITE 扩展支持。

兼容模式 (JSON)

使用精简过的 JSON 数据作为数据载体,一次性加载所有数据到变量,内存占用中(30+ MB),性能差。

内存占用量以实际为准,根据版本、扩展等环境的不同,占用的内存容量不一样,上述值为我电脑上的情况,仅供参考。

适合无法使用 PDO 的场景。

由于精简了数据,一些拼音结果需要经过代码计算处理才可以得出,所以性能较差。

FFI 模式 (FFI)

需要 PHP >= 7.4 并且启用 FFI 扩展,代码全部由 C++ 开发,性能和内存占用都比 PHP 实现的要好。

FFI 动态库 C++ 代码:https://github.com/Yurunsoft/chinese-util-cpp

Swoole FFI 模式 (SwooleFFI)

需要 PHP >= 7.4 并且启用 FFI、Swoole 扩展,代码全部由 C++ 开发,性能和内存占用都比 PHP 实现的要好。

不会阻塞 PHP 代码所在线程。


默认情况下,优先使用通用模式,如果环境不支持 PDO 将采用兼容模式。

你可以在未执行任何初始化或者转换处理之前,设置使用何种模式运行。

无论何种模式,拼音分词所需数据总是从 JSON 数据中加载。

FFI 参数设置:(一般用于自己编译的情况)

使用说明

Composer 直接安装

composer require yurunsoft/chinese-util

Composer 项目配置引入

功能

汉字转拼音

拼音分词

结果是字符串:

输出结果:

结果是数组:

输出结果:

简繁互转

输出结果:

数字转换

输出结果:

金额数字转换

输出结果:


All versions of chinese-util with dependencies

PHP Build Version
Package Version
No informations.
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 yurunsoft/chinese-util contains the following files

Loading the files please wait ....