https://github.com/rny/zhconverter
convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant)
https://github.com/rny/zhconverter
convertion php zh-hans zh-hant zhconverter
Last synced: about 2 months ago
JSON representation
convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant)
- Host: GitHub
- URL: https://github.com/rny/zhconverter
- Owner: rny
- License: mit
- Created: 2016-10-30T15:05:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-02T15:50:57.000Z (over 8 years ago)
- Last Synced: 2025-04-13T15:12:34.101Z (about 2 months ago)
- Topics: convertion, php, zh-hans, zh-hant, zhconverter
- Language: PHP
- Size: 144 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZhConverter
[](https://travis-ci.org/rny/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
* One line code to do the convertion
* Composer ready, PSR-4 compatible.
* PHPUnit tested.## Install
Install `ZhConverter` using Composer.
```
$ composer require rny/zhconverter
```## Usage
```
use Rny\ZhConverter\ZhConverter;$text = ZhConverter::zh2hant($text);
$text = ZhConverter::zh2hans($text);
$text = ZhConverter::zh2TW($text);
$text = ZhConverter::zh2HK($text);
$text = ZhConverter::zh2CN($text);
``````
$text = \Rny\ZhConverter\ZhConverter::zh2hant($text);
$text = \Rny\ZhConverter\ZhConverter::zh2hans($text);
$text = \Rny\ZhConverter\ZhConverter::zh2TW($text);
$text = \Rny\ZhConverter\ZhConverter::zh2HK($text);
$text = \Rny\ZhConverter\ZhConverter::zh2CN($text);
```## Testing
```
$ composer test
```