PHPackages                             cytsunny/rand-chinese - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. cytsunny/rand-chinese

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

cytsunny/rand-chinese
=====================

中文亂文生成器

1.0.1(8y ago)216LGPL3.0PHP

Since Jul 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/cytsunny/randChinese)[ Packagist](https://packagist.org/packages/cytsunny/rand-chinese)[ Docs](https://github.com/cytsunny/randChinese)[ RSS](/packages/cytsunny-rand-chinese/feed)WikiDiscussions master Synced 4w ago

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

中文亂文隨機生成器
=========

[](#中文亂文隨機生成器)

為什麼需要這個亂文生成器？
-------------

[](#為什麼需要這個亂文生成器)

現在比較好的亂文生成器主要都是直接在網上生成，只可以人手複製到要用的地方。如果只是用來設計時試排版是沒問題的，但是有如果需要大量生成就不太方便。（例如做 unit test 的時候想要中文輸入）

另一個常見的做法就是在 UTF8 中指定漢字一段，再隨機在其中抽出文字。這樣生出來的字大概是這樣的：

> 悍箳寊貈绺鶭缂迩泜輅歍銋囄轴埄侭鐸攛塰俟兯锁沟忍鳚苚鉤

雖然生出來的是方塊字，但太陌生的字看起來還是不像是中文。（事實上也真的可能不是中文，因為那段叫 CJK － Chinese, Japanese, Korean，即中文正體字、簡體字、日本漢字和韓國用的漢字都包含在內。因為有些的確是一樣的，所以這不能怪 UTF8。）

這個生成器使用香港課程發展處中國語文教育組的《[中英文對照香港學校中文學習基礎字詞](http://www.edbchinese.hk/lexlist_en/)》中記載的正體字，只收錄大概 4000 多個在香港中小學會接觸到的正體字。生出來的字大概是這樣的：

> 攻格瑣雇嬪腐楓蹉臭舖黏沖賒廬侮彭疼呃淅龐

好吧，雖然總算是一些讀得出來的字了，但看起來還是有點太複雜。所以我還增加了一個複雜程度的選項。我把 4000 多個字按筆劃多少排序，由少筆劃到多筆劃，然後從中抽取頭 500 個（這個數字可以選擇）。生出來的字大概是這樣：

> 朽乏斤允叉企十妃划巧毛任只舌吁冬低乙友弘

如何使用這個生成器？
----------

[](#如何使用這個生成器)

你可以直接下載 randChinese.php，或使用composer:

```
composer require cytsunny/randChinese

```

然後：

```
include ('path/to/your/download/randChinese.php') //只有你知道你把代碼下載到哪裡。請自行填寫正確的路徑。
use RandChinese\RandChinese;
echo RandChinese::phase(); //沒有數字的話預設生成 20 個中文字
echo '\n';
echo RandChinese::phase(40);//你也可以輸入想要的長度
echo '\n';
echo RandChinese::phase(20, 2000); //後面的數字決定複雜程度，可以是任何小於 4000 的數字
```

未來可能會增加的功能
----------

[](#未來可能會增加的功能)

實際做出來的時間視乎有多少人想要，以及多少人使用這個生成器。

1. 支援 composer
2. 增加「加入標點符號」這個選項
3. 選擇生成較顯淺的中文字（主要看筆劃決定難度）
4. 生成中文名稱
5. 製作 Javascript 版本

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~294 days

Total

2

Last Release

2988d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3927120?v=4)[Sunny Chan](/maintainers/cytsunny)[@cytsunny](https://github.com/cytsunny)

---

Top Contributors

[![cytsunny](https://avatars.githubusercontent.com/u/3927120?v=4)](https://github.com/cytsunny "cytsunny (14 commits)")

---

Tags

loglogging

### Embed Badge

![Health badge](/badges/cytsunny-rand-chinese/health.svg)

```
[![Health](https://phpackages.com/badges/cytsunny-rand-chinese/health.svg)](https://phpackages.com/packages/cytsunny-rand-chinese)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k997.8M7.9k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k258.2M1.7k](/packages/symfony-monolog-bundle)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k240.0M315](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k122.6M186](/packages/sentry-sentry-laravel)[rap2hpoutre/laravel-log-viewer

A Laravel log reader

3.2k15.2M77](/packages/rap2hpoutre-laravel-log-viewer)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

327137.6M163](/packages/sentry-sdk)

PHPackages © 2026

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