steelywing / chinese
中文繁簡轉換 Convert Traditional and Simplified Chinese
    0.5.3
    2019-06-10 01:58 UTC
README
PHP Chinese Conversion, 简单,轻量(v0.2 with WikiMedia Library < 400KB)
安装
使用 Composer
composer require steelywing/chinese
手动安装
- 
克隆此仓库 git clone https://github.com/steelywing/PHP-Chinese.git
- 
生成 autoload.php,在PHP-Chinese文件夹中运行composer dump-autoload
功能
- 使用 WikiMedia 或 OpenCC 库
- 轻量级
- 使用最长匹配规则
示例
更多使用方法,请参阅 demo.php
require_once __DIR__ . '/vendor/autoload.php'; use SteelyWing\Chinese\Chinese; $chinese = new Chinese(); echo $chinese->to(Chinese::ZH_HANS, '轉成簡體中文'); // 转成简体中文 echo $chinese->to(Chinese::ZH_HANT, '转成繁体中文'); // 轉成繁體中文
切换库
切换到 OpenCC,在 dict 文件夹中运行以下命令
git clone https://github.com/BYVoid/OpenCC.git php import_opencc.php
切换到 WikiMedia,在 dict 文件夹中运行以下命令
php import_wikimedia.php
许可证
MIT