PHPackages                             guang/php-opencc-php56 - 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. guang/php-opencc-php56

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

guang/php-opencc-php56
======================

中文简繁转换，支持词汇级别的转换、异体字转换和地区习惯用词转换（中国大陆、台湾、香港、日本新字体）。基于 \[BYVoid/OpenCC\](https://github.com/BYVoid/OpenCC) 数据实现。

v1.1(1y ago)18MITPHPPHP &gt;=5.6

Since Apr 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/iq001/php-opencc-php56)[ Packagist](https://packagist.org/packages/guang/php-opencc-php56)[ RSS](/packages/guang-php-opencc-php56/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

来源
==

[](#来源)

这个包来源于： ，为啥要做同个功能的轮子呢？因为这个包不支持php8以前的版本，我有些老项目，升级比较麻烦，因此把代码稍微改了一下，以便php5.6以后的版本都能用。 如果你的php版本在php8以上，请使用  ，以便获取最新的更新，虽然我的这个包也能在php8的环境下跑，但是性能肯定没有官方的那么好，因为jit原因。

这个版本阉割了命令行功能，因为有些命令行有些单独的依赖，那些依赖也使用了php8，因此去掉了。

如果遇到不兼容的问题，直接提issue，我会尽量在24小时之内处理完毕。

PHP OpenCC
==========

[](#php-opencc)

中文简繁转换，支持词汇级别的转换、异体字转换和地区习惯用词转换（中国大陆、台湾、香港、日本新字体）。基于 [BYVoid/OpenCC](https://github.com/BYVoid/OpenCC) 数据实现。

[![Build Status](https://github.com/iq001/php-opencc-php56/actions/workflows/test.yml/badge.svg)](https://github.com/iq001/php-opencc-php56/actions/workflows/test.yml)[![Latest Stable Version](https://camo.githubusercontent.com/d62d54d1beda1d18c1d74b494f266d0631ab94fb830cedc167674f1f6bde42f4/68747470733a2f2f706f7365722e707567782e6f72672f6775616e672f7068702d6f70656e63632d70687035362f762f737461626c65)](https://packagist.org/packages/guang/php-opencc-php56)[![Total Downloads](https://camo.githubusercontent.com/43562ddfeb50f4a162dc38774caaf9e1de9d167f174225f94a5cc4363fd519fb/68747470733a2f2f706f7365722e707567782e6f72672f6775616e672f7068702d6f70656e63632d70687035362f646f776e6c6f616473)](https://packagist.org/packages/guang/php-opencc-php56)[![License](https://camo.githubusercontent.com/a02f039d3cfe9a318f17e4ce82bcafc73efb88af3bec49a1ee00377f56b069cd/68747470733a2f2f706f7365722e707567782e6f72672f6775616e672f7068702d6f70656e63632d70687035362f6c6963656e7365)](https://packagist.org/packages/guang/php-opencc-php56)

安装
--

[](#安装)

```
composer require guang/php-opencc-php56 -vvv
```

使用
--

[](#使用)

```
use Guang\OpenCC\OpenCC;

echo OpenCC::convert('服务器', 'SIMPLIFIED_TO_TAIWAN_WITH_PHRASE');
// output: 伺服器
```

### 使用策略别名

[](#使用策略别名)

```
use Guang\OpenCC\OpenCC;
use Guang\OpenCC\Strategy;

// 以下方法等价：

// 方法
echo OpenCC::s2tw('服务器');
echo OpenCC::simplifiedToTaiwan('服务器');

// 字符串
echo OpenCC::convert('服务器', 's2tw');
echo OpenCC::convert('服务器', 'S2TW');
echo OpenCC::convert('服务器', 'SIMPLIFIED_TO_TAIWAN');

// 常量
echo OpenCC::convert('服务器', Strategy::S2TW);
echo OpenCC::convert('服务器', Strategy::SIMPLIFIED_TO_TAIWAN);
```

### 转换策略

[](#转换策略)

策略 （别名）说明`SIMPLIFIED_TO_TRADITIONAL(S2T)`简体到繁体`SIMPLIFIED_TO_HONGKONG(S2HK)`简体到香港繁体`SIMPLIFIED_TO_JAPANESE(S2JP)`简体到日文`SIMPLIFIED_TO_TAIWAN(S2TW)`简体到台湾正体`SIMPLIFIED_TO_TAIWAN_WITH_PHRASE(2TWP)`简体到台湾正体, 带词汇本地化`HONGKONG_TO_TRADITIONAL(HK2T)`香港繁体到正体`HONGKONG_TO_SIMPLIFIED(HK2S)`香港繁体到简体`TAIWAN_TO_SIMPLIFIED(TW2S)`台湾正体到简体`TAIWAN_TO_TRADITIONAL(TW2T)`台湾正体到繁体`TAIWAN_TO_SIMPLIFIED_WITH_PHRASE(TW2SP)`台湾正体到简体, 带词汇本地化`TRADITIONAL_TO_HONGKONG(T2HK)`正体到香港繁体`TRADITIONAL_TO_SIMPLIFIED(T2S)`繁体到简体`TRADITIONAL_TO_TAIWAN(T2TW)`繁体到台湾正体`TRADITIONAL_TO_JAPANESE(T2JP)`繁体到日文`JAPANESE_TO_TRADITIONAL(JP2T)`日文到繁体`JAPANESE_TO_SIMPLIFIED(JP2S)`日文到简体License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

2

Last Release

401d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1c2595ac664453e416f89ba2a9a9294e883a259cb763e25c304c3e75e524f0d?d=identicon)[iq001](/maintainers/iq001)

---

Top Contributors

[![iq001](https://avatars.githubusercontent.com/u/37325572?v=4)](https://github.com/iq001 "iq001 (5 commits)")

### Embed Badge

![Health badge](/badges/guang-php-opencc-php56/health.svg)

```
[![Health](https://phpackages.com/badges/guang-php-opencc-php56/health.svg)](https://phpackages.com/packages/guang-php-opencc-php56)
```

###  Alternatives

[kevinsimard/laravel-cookieless-session

Laravel middleware to start a cookieless session

1417.0k](/packages/kevinsimard-laravel-cookieless-session)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
