wikimedia/cldr-plural-rule-parser
Evaluates plural rules specified in the CLDR project notation.
Maintainers
Package info
github.com/wikimedia/CLDRPluralRuleParser
pkg:composer/wikimedia/cldr-plural-rule-parser
v3.0.1
2026-05-06 00:04 UTC
Requires
- php: >=8.1
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 51.0.0
- mediawiki/mediawiki-phan-config: 0.20.0
- mediawiki/minus-x: 2.0.1
- ockcyp/covers-validator: 1.7.0
- php-parallel-lint/php-console-highlighter: 1.0.0
- php-parallel-lint/php-parallel-lint: 1.4.0
- phpunit/phpunit: 10.5.63
Suggests
None
Provides
None
Conflicts
None
Replaces
None
GPL-2.0-or-later 8c225fdf7c2a0bcd1dbae907cd3354838670cfd6
- Tim Starling <tstarling.woop@wikimedia.org>
- Niklas Laxström <niklas.laxstrom.woop@gmail.com>
This package is auto-updated.
Last update: 2026-06-15 13:13:03 UTC
README
CLDRPluralRuleParser is a PHP library for parsing plural rules specified in the CLDR project.
This library does not contain the rules from the CLDR project, you have to get them yourself.
Here is how you use it:
use CLDRPluralRuleParser\Evaluator; // Example for English $rules = ['i = 1 and v = 0']; $forms = ['syntax error', 'syntax errors']; for ( $i = 0; $i < 3; $i++ ) { $index = Evaluator::evaluate( $i, $rules ); echo "This code has $i{$forms[$index]}\n"; } // This code has 0 syntax errors // This code has 1 syntax error // This code has 2 syntax errors
License
The project is licensed under the GPL license 2 or later.
