This repository is a PHP library / Zend Framework 2 module that converts numbers into words using language definition files in the Soros format.
The library is organized so a developer can understand it by reading source files and language definitions without needing to run the code.
- Convert numeric values into spelled-out text.
- Support many languages through Soros definition files stored in
language/. - Provide a Zend filter and view helper for use in ZF2 applications.
composer.json- package metadata, dependencies, and PSR-0 autoloading forNumberText\.Module.php- module bootstrap point that loads the source code.config/module.config.php- ZF2 configuration exposing the view helpernumberText.src/NumberText/Filter/NumberText.php- a Zend I18n filter implementation that reads a Soros file and converts values.src/NumberText/Service/Soros.php- the Soros interpreter and parser. This is the core logic for reading a.sordefinition and applying rules.src/NumberText/View/Helper/NumberText.php- a Zend view helper wrapper around the filter.language/*.sor- language definition files in Soros format. These files define number-to-words rules for each supported locale.
- The filter currently loads a hardcoded file:
language/pt_BR.sor. Soros.phpparses Soros syntax and uses regular expressions and recursive rule evaluation to transform numeric input into text.- The view helper constructs the filter and returns the formatted text for templates.
- Start with
src/NumberText/Filter/NumberText.phpto see how the module integrates with Zend's filter system. - Read
src/NumberText/Service/Soros.phpnext to understand the rule parsing and execution. - Review
src/NumberText/View/Helper/NumberText.phpto see how the helper is exposed to views. - Inspect
config/module.config.phpto confirm the helper registration. - Browse
language/*.sorto understand the localization definitions and supported languages.
If you want to contribute by reading files only, focus on these areas:
- Improve or generalize the language-selection logic in
src/NumberText/Filter/NumberText.php. - Add tests or documentation for new languages by comparing existing
.sorfiles. - Refactor
src/NumberText/Service/Soros.phpfor readability, while preserving Soros parsing behavior. - Update
config/module.config.phpif the module should expose additional services or helpers.
- This project is built for PHP 5.5+ and Zend Framework 2.
- The library uses PSR-0 autoloading and classmap fallback in
composer.json. - No runtime or build commands are required to understand the project structure.