PHPackages                             mdsills/cccedict - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mdsills/cccedict

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

mdsills/cccedict
================

Parser for CC-CEDICT Chinese-English dictionary

v1.0.0(2y ago)5723515MITPHPPHP &gt;=7.0

Since Nov 4Pushed 2y ago9 watchersCompare

[ Source](https://github.com/mdsills/cccedict)[ Packagist](https://packagist.org/packages/mdsills/cccedict)[ Docs](https://github.com/mdsills/cccedict)[ RSS](/packages/mdsills-cccedict/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

cccedict
========

[](#cccedict)

PHP Version
-----------

[](#php-version)

This parser is written for &gt;= PHP7. It will not work on PHP5.

Demo
----

[](#demo)

Download the current CC-CEDICT file from  into the demo folder.

```
cd demo
composer install
wget -O cedict.gz https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz
php -f index.php

```

About
-----

[](#about)

Reads from a CC-CEDICT Chinese dictionary file, and outputs structured data.

Options
-------

[](#options)

### Required settings

[](#required-settings)

- setFilePath() sets path of file to extract and process

### Optional settings

[](#optional-settings)

- setBlockSize(int) sets block size to read and parse at a time
- setStartLine(int) in case you don't want to start from the beginning
- setNumberOfBlocks(float) in case you don't want to read all the way to the end. You can use INF.
- setOptions(array) define which data you want returned (see below)

Returned data
-------------

[](#returned-data)

The parser will return an array with:

- an array of Entry objects filled with data as per your configuration (see below)
- an array of any skipped lines
- the number of parsed lines
- the number of skipped lines

### Basic Entry object

[](#basic-entry-object)

By default, the parser will fill the Entry object with:

- an array of English translations from the dictionary entry
- an array of traditional characters from the dictionary entry
- an array of simplified characters from the dictionary entry

### Customising the Entry object

[](#customising-the-entry-object)

With setOptions(array) (see above), you can change the data included in the Entry object. If any options are set, the Entry will not include any data that is not specified with setOptions()!

- `Entry::F_ORIGINAL` includes the original unparsed line from CC-CEDICT
- `Entry::F_TRADITIONAL` includes a string with the dictionary entry in traditional characters
- `Entry::F_SIMPLIFIED` same as above but in simplified characters
- `Entry::F_PINYIN` includes a string of pinyin as formatted in CC-CEDICT (numeric but with ideosyncrasies)
- `Entry::F_PINYIN_NUMERIC` includes a string of pinyin converted to numeric Hanyu Pinyin
- `Entry::F_PINYIN_DIACRITIC` includes a string of pinyin converted to Hanyu Pinyin with diacritics
- `Entry::F_ENGLISH` includes a string with all the English translations for the dictionary entry
- `Entry::F_ENGLISH_EXPANDED` includes an array with the above English translations
- `Entry::F_TRADITIONAL_CHARS` includes an array of all traditional characters in the dictionary entry
- `Entry::F_SIMPLIFIED_CHARS` same as above but with simplified characters

Limitations, bugs, roadmap
--------------------------

[](#limitations-bugs-roadmap)

### Opportunities for improvement

[](#opportunities-for-improvement)

- Well perhaps it could output various formats (e.g. JSON) instead of simply arrays?
- Any further Chinese in the English translation (references, alternative spellings, or full forms of abbreviations) could be structured and nested
- getFull() still needs to be described (and made accessible, or removed)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 59.1% 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

Unknown

Total

1

Last Release

962d ago

### Community

Maintainers

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

---

Top Contributors

[![bluppfisk](https://avatars.githubusercontent.com/u/5723444?v=4)](https://github.com/bluppfisk "bluppfisk (13 commits)")[![matthew-emw](https://avatars.githubusercontent.com/u/55453928?v=4)](https://github.com/matthew-emw "matthew-emw (5 commits)")[![mdsills](https://avatars.githubusercontent.com/u/1948477?v=4)](https://github.com/mdsills "mdsills (3 commits)")[![jfcherng](https://avatars.githubusercontent.com/u/6594915?v=4)](https://github.com/jfcherng "jfcherng (1 commits)")

---

Tags

dictionaryChinesecc-cedict

### Embed Badge

![Health badge](/badges/mdsills-cccedict/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[json-mapper/laravel-package

The JsonMapper package for Laravel

25188.9k3](/packages/json-mapper-laravel-package)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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