PHPackages                             jrmajor/pluralrules - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. jrmajor/pluralrules

ActiveLibrary[Localization &amp; i18n](/categories/localization)

jrmajor/pluralrules
===================

Identify plural categories according to CLDR

v1.2.0(5mo ago)520.1k↑141.7%1[2 PRs](https://github.com/jrmajor/pluralrules/pulls)1MITPHPPHP 8.3 - 8.5CI passing

Since Jul 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/jrmajor/pluralrules)[ Packagist](https://packagist.org/packages/jrmajor/pluralrules)[ Docs](https://github.com/jrmajor/pluralrules)[ GitHub Sponsors](https://github.com/jrmajor)[ RSS](/packages/jrmajor-pluralrules/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (11)Versions (15)Used By (1)

jrmajor/pluralrules
===================

[](#jrmajorpluralrules)

[![Latest Stable Version](https://camo.githubusercontent.com/a91015550917d972c9ed0ccca08aa9d7594c5a56a5c7e2120e11c4f17080f0c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a726d616a6f722f706c7572616c72756c65732e737667)](https://packagist.org/packages/jrmajor/pluralrules)[![Required PHP Version](https://camo.githubusercontent.com/839ca31c307eed6a4ef76b941a2dd93fbf6c2bfb4012252996f895845d4a98fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a726d616a6f722f706c7572616c72756c65732e737667)](https://packagist.org/packages/jrmajor/pluralrules)

A PHP package for identifying the plural category, according to [CLDR](https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/plurals.json), for a given number.

```
Major\PluralRules\PluralRules::select('en', 1);   // 'one'
Major\PluralRules\PluralRules::select('en', 2);   // 'other'
```

```
Major\PluralRules\PluralRules::select('pl', 1);   // 'one'
Major\PluralRules\PluralRules::select('pl', 42);  // 'few'
Major\PluralRules\PluralRules::select('pl', 45);  // 'many'
Major\PluralRules\PluralRules::select('pl', 1.5); // 'other'
```

You may install it via composer: `composer require jrmajor/pluralrules`.

Contributing
------------

[](#contributing)

This package works by compiling CLDR plural rules to PHP closures like [these](rules/pl.php). This is done by `gen` script (`php gen rules` and `php gen tests`). Before running it, you would need to run `yarn install` to download [`cldr-core`](https://github.com/unicode-org/cldr-json/tree/main/cldr-json/cldr-core) package.

Testing
-------

[](#testing)

```
vendor/bin/phpunit           # Tests
vendor/bin/phpstan analyze   # Static analysis
vendor/bin/php-cs-fixer fix  # Formatting
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance79

Regular maintenance activity

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 91.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

Every ~231 days

Recently: every ~286 days

Total

8

Last Release

162d ago

Major Versions

v0.1.0 → v1.0.02021-07-13

PHP version history (6 changes)v0.1.0PHP ^8.0

v1.0.1PHP ~8.0.0 || ~8.1.0

v1.1.0PHP 8.1 - 8.2

v1.1.2PHP 8.1 - 8.3

v1.1.3PHP 8.2 - 8.4

v1.2.0PHP 8.3 - 8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a821db490b1337a762f89c118ef7952e54c5f4cc473f915b5165f281956a9e3?d=identicon)[jrmajor](/maintainers/jrmajor)

---

Top Contributors

[![jrmajor](https://avatars.githubusercontent.com/u/26096713?v=4)](https://github.com/jrmajor "jrmajor (173 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")

---

Tags

localizationinternationalizationi18nlanguagel10npluralcldrplural ruleslocaleplural categories

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jrmajor-pluralrules/health.svg)

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

###  Alternatives

[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[aplus/language

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[jrmajor/fluent

Fluent localization system for PHP

2716.9k5](/packages/jrmajor-fluent)[jrmajor/laravel-fluent

Fluent translations for Laravel

208.4k](/packages/jrmajor-laravel-fluent)[fisharebest/localization

A lightweight localization database and translation tools, with data from the CLDR, IANA, ISO, etc.

3191.1k2](/packages/fisharebest-localization)

PHPackages © 2026

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