overtrue/pinyin
66.3
Adequate · 19 September 2026
252.6k
lines of production code
PHP
primary language
1
measurement over time
What this system is
This system is a PHP library for converting Chinese text into Pinyin, featuring a strategy-based architecture that allows users to balance memory usage and conversion speed. It provides a fluent API for various conversion needs, including surname-aware name formatting, phrase processing, and permalink generation. The library includes comprehensive pronunciation data for characters, surnames, and idioms, along with CLI tools for data management and benchmarking utilities for performance evaluation.
Features
Initial release of Chinese pronunciation data
The application now includes a comprehensive dataset for Chinese character and word pronunciation. This update adds \data/chars.php\ for individual character readings, \data/surnames.php\ for correct surname pronunciations, and split \data/words-\*.php\ files containing pinyin for multi-character words and idioms, enabling accurate text-to-speech and pronunciation lookup features.
data · high confidence
New CLI tool and build script for Pinyin data management
The \bin\ directory now includes a new \pinyin\ command-line interface and a \build\ script. The CLI allows users to convert Chinese text to pinyin using various methods (sentence, fullSentence, name, passportName, phrase, permalink, heteronym, chars, abbr, etc.) with options for JSON output, tone styles, and compact formatting. The build script automates the download and processing of pinyin data sources, handling heteronyms, surnames, and character data to generate the necessary data files for the library.
bin · high confidence
New benchmark suite for comparing Pinyin conversion strategies
Added a new benchmark suite in the \benchmark/\ directory to evaluate and compare the performance of different Pinyin conversion strategies (Memory Optimized, Cached, and Smart). The suite includes \run.php\ and \compare-strategies.php\ scripts that measure execution time and memory usage across various text lengths and scenarios (cold start, warm cache, batch processing), providing users with data to choose the most efficient strategy for their specific use case.
benchmark · high confidence
Behavioural changes
Major v6.0 rewrite with strategy-based conversion and new API
The library has been rewritten for version 6.0, introducing a new fluent API and a factory-based architecture that allows users to choose between three conversion strategies: Memory Optimized (default, low memory), Cached (fastest, higher memory), and Smart (balanced). The new \Pinyin\ class provides dedicated static methods for specific use cases, including \name()\ for surname-aware conversion, \passportName()\ for official document formatting, \phrase()\, \sentence()\, and \fullSentence()\ for different text granularities, and \abbr()\ which now supports preserving English words. The conversion engine now uses a \ConverterInterface\ and \Collection\ class, replacing the previous implementation to improve performance and flexibility.
src · high confidence
Version 6.0.0 introduces performance optimization strategies and API changes
This release upgrades the library to version 6.0.0, introducing a new performance optimization strategy system that allows users to choose between Memory Optimized, Cached, and Smart strategies to balance memory usage and conversion speed. The default strategy has changed to Memory Optimized to reduce default memory footprint, and new static methods like \useMemoryOptimized()\, \useCached()\, \useSmart()\, and \useAutoStrategy()\ are available on the \Pinyin\ class to select these strategies. A new \ConverterFactory\ is provided for managing converter instances, and the \ToneStyle\ enum is now recommended for specifying tone formats. The release also includes updated documentation, benchmarking tools, and configuration files for PHPStan and PHPUnit.
(repo-wide) · high confidence
Test coverage
Added comprehensive test suite for Pinyin library components
Added PHPUnit tests covering the Collection class (construction, iteration, JSON serialization, and ArrayAccess), the ConverterFactory (strategy selection, default strategy management, and context-based recommendations), and the three converter strategies (MemoryOptimized, Cached, and Smart) to verify functional parity, tone style handling, surname resolution, and memory usage characteristics. Additional tests validate the Pinyin facade's static method chaining, strategy switching, and specific conversion behaviors for names, phrases, and permalinks.
tests · high confidence
Dependencies
Update project dependencies and PHP version requirement
The composer.json manifest has been updated to require PHP 8.1 or higher. Development dependencies have been upgraded to phpunit ^10.5/11.5/12.0, brainmaestro/composer-git-hooks ^3.0, nunomaduro/termwind ^1.0/2.0, and laravel/pint ^1.10.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 66.
Lenses
- Code Health 99
- Architecture 66
- Maturity 59
- Readiness 72
- Security 82
Changes since last survey
- 300 commits — 220 feature/other, 80 fixes
By area
- (root) — 130 commits
- src/Pinyin — 50 commits
- (repo) — 24 commits
- src/Pinyin.php — 15 commits
- data/words_0 — 7 commits
- tests/PinyinTest.php — 6 commits
- data/surnames — 5 commits
- data/words_1 — 5 commits
- src/FileDictLoader.php — 5 commits
- src/data — 5 commits
- tests/PerformanceTest.php — 5 commits
- src/Converter.php — 3 commits
- src/Converters — 3 commits
- src/GeneratorFileDictLoader.php — 3 commits
- tests/TestCase.php — 3 commits
- .github/FUNDING.yml — 2 commits
- .github/workflows — 2 commits
- data/words-1.php — 2 commits
- data/words-7.php — 2 commits
- data/words_4 — 2 commits
Notable commits
- fix: #4 fix scrutinizer-ci bug
- fix: #4 fix test
- fix: #4 fix test
- fix: #5 fix service provider bug
- fix: Applied fixes from StyleCI (#59)
- fix: Apply fixes from StyleCI (#104)
- fix: Apply fixes from StyleCI (#113)
- fix: Apply fixes from StyleCI (#129)
- fix: Apply fixes from StyleCI (#132)
- fix: Apply fixes from StyleCI (#154)
- fix: Apply fixes from StyleCI (#155)
- fix: Apply fixes from StyleCI (#94)
- fix: Bugfix #25
- fix: Bugfix #25
- fix: Bugfix #26
- fix: Bugfix #81
- fix: Bugfix. solved #39
- fix: First letters bugfix #27
- fix: Fix #108
- fix: Fix #22
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
overtrue/pinyin was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit fa8d9f673a51829403d5296902152dc03be4e395 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.