PHPackages                             zgn/zhconverter - 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. zgn/zhconverter

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

zgn/zhconverter
===============

convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant)

1.0.1(7y ago)011MITPHP

Since Oct 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/zgn/ZhConverter)[ Packagist](https://packagist.org/packages/zgn/zhconverter)[ RSS](/packages/zgn-zhconverter/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

ZhConverter
===========

[](#zhconverter)

[![Build Status](https://camo.githubusercontent.com/1c50c6a8ae0b4d8d22ceb45472baee2f1bc3f05995e053e9de0009ef6e64c25b/68747470733a2f2f7472617669732d63692e6f72672f7a676e2f5a68436f6e7665727465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zgn/ZhConverter)

ZhConverter is a simple PHP library to convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant). ZhConverter is using WikiMedia [ZhConverter.php](https://github.com/wikimedia/mediawiki/tree/master/languages/data) as convertion table.

For those rquire better convertion quality, the C++ project [OpenCC](https://github.com/BYVoid/OpenCC) may be considered.

Highlights
----------

[](#highlights)

- One line code to do the convertion
- Composer ready, PSR-4 compatible.
- PHPUnit tested.

Install
-------

[](#install)

Install `ZhConverter` using Composer.

```
$ composer require zgn/zhconverter

```

Usage
-----

[](#usage)

```
use Zgn\ZhConverter\ZhConverter;

$text = ZhConverter::zh2hant($text);
$text = ZhConverter::zh2hans($text);
$text = ZhConverter::zh2TW($text);
$text = ZhConverter::zh2HK($text);
$text = ZhConverter::zh2CN($text);

```

```
$text = \Zgn\ZhConverter\ZhConverter::zh2hant($text);
$text = \Zgn\ZhConverter\ZhConverter::zh2hans($text);
$text = \Zgn\ZhConverter\ZhConverter::zh2TW($text);
$text = \Zgn\ZhConverter\ZhConverter::zh2HK($text);
$text = \Zgn\ZhConverter\ZhConverter::zh2CN($text);

```

Testing
-------

[](#testing)

```
$ composer test

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~708 days

Total

2

Last Release

2776d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8011105?v=4)[zgn](/maintainers/zgn)[@zgn](https://github.com/zgn)

---

Top Contributors

[![rny](https://avatars.githubusercontent.com/u/7847940?v=4)](https://github.com/rny "rny (5 commits)")[![zgn](https://avatars.githubusercontent.com/u/8011105?v=4)](https://github.com/zgn "zgn (1 commits)")

---

Tags

Chinese

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zgn-zhconverter/health.svg)

```
[![Health](https://phpackages.com/badges/zgn-zhconverter/health.svg)](https://phpackages.com/packages/zgn-zhconverter)
```

###  Alternatives

[overtrue/pinyin

Chinese to pinyin translator.

4.5k6.5M72](/packages/overtrue-pinyin)[zhuzhichao/ip-location-zh

get the ip's location info with Chinese

617212.5k11](/packages/zhuzhichao-ip-location-zh)[overtrue/chinese-calendar

中国农历转换与查询工具

557103.7k4](/packages/overtrue-chinese-calendar)[zhuzhichao/bank-card-info

Get the bank card info

45464.8k](/packages/zhuzhichao-bank-card-info)[douyasi/identity-card

Chinese Identity Card package

17851.4k3](/packages/douyasi-identity-card)[wilon/php-number2chinese

PHP数字转为汉字描述、人民币大写方法。

14632.0k1](/packages/wilon-php-number2chinese)

PHPackages © 2026

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