PHPackages                             arraypress/inflector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/inflector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/inflector
====================

A PHP library for pluralizing and singularizing English words with comprehensive irregular and uncountable word handling.

10PHP

Since Nov 30Pushed 7mo agoCompare

[ Source](https://github.com/arraypress/inflector)[ Packagist](https://packagist.org/packages/arraypress/inflector)[ RSS](/packages/arraypress-inflector/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Inflector
=========

[](#inflector)

A PHP library for pluralizing and singularizing English words with comprehensive irregular and uncountable word handling.

Installation
------------

[](#installation)

```
composer require arraypress/inflector
```

Usage
-----

[](#usage)

### Basic Pluralization

[](#basic-pluralization)

```
pluralize( 'cat' );       // 'cats'
pluralize( 'category' );  // 'categories'
pluralize( 'child' );     // 'children'
pluralize( 'person' );    // 'people'
pluralize( 'analysis' );  // 'analyses'
```

### Basic Singularization

[](#basic-singularization)

```
singularize( 'cats' );       // 'cat'
singularize( 'categories' ); // 'category'
singularize( 'children' );   // 'child'
singularize( 'people' );     // 'person'
singularize( 'analyses' );   // 'analysis'
```

### Conditional Inflection

[](#conditional-inflection)

```
// Returns singular when count is 1, plural otherwise
inflect( 'cat', 1 );   // 'cat'
inflect( 'cat', 2 );   // 'cats'
inflect( 'cat', 0 );   // 'cats'

// Or use the count parameter on pluralize
pluralize( 'item', 1 );  // 'item'
pluralize( 'item', 5 );  // 'items'
```

### Detection

[](#detection)

```
is_plural( 'cats' );        // true
is_plural( 'children' );    // true
is_plural( 'cat' );         // false

is_singular( 'cat' );       // true
is_singular( 'person' );    // true
is_singular( 'people' );    // false

is_uncountable( 'sheep' );       // true
is_uncountable( 'information' ); // true
is_uncountable( 'cat' );         // false
```

### Case Preservation

[](#case-preservation)

The inflector preserves the case pattern of the original word:

```
pluralize( 'Cat' );      // 'Cats'
pluralize( 'CAT' );      // 'CATS'
pluralize( 'Person' );   // 'People'
pluralize( 'PERSON' );   // 'PEOPLE'

singularize( 'CHILDREN' );  // 'CHILD'
singularize( 'People' );    // 'Person'
```

### Using the Class Directly

[](#using-the-class-directly)

If you prefer, you can also use the `Inflector` class directly:

```
use ArrayPress\Inflector\Inflector;

Inflector::pluralize( 'category' );    // 'categories'
Inflector::singularize( 'children' );  // 'child'
Inflector::is_plural( 'cats' );        // true
Inflector::clear_cache();              // Clear internal caches
```

Supported Word Types
--------------------

[](#supported-word-types)

### Irregular Words

[](#irregular-words)

The library handles 150+ irregular English words including:

- **People**: person/people, man/men, woman/women, child/children
- **Body parts**: tooth/teeth, foot/feet, goose/geese
- **Animals**: mouse/mice, louse/lice, ox/oxen
- **Latin/Greek**: criterion/criteria, phenomenon/phenomena, analysis/analyses, thesis/theses
- **Latin -us**: cactus/cacti, fungus/fungi, nucleus/nuclei, radius/radii
- **Latin -a**: alumna/alumnae, antenna/antennae, formula/formulae
- **Latin -ex/-ix**: index/indices, matrix/matrices, vertex/vertices
- **French**: bureau/bureaux, chateau/chateaux, plateau/plateaux
- **f/fe endings**: leaf/leaves, life/lives, knife/knives, wolf/wolves
- **Compound words**: passerby/passersby, son-in-law/sons-in-law

### Uncountable Words

[](#uncountable-words)

Words that remain the same in singular and plural:

- **Animals**: sheep, fish, deer, moose, salmon, trout, bison
- **Abstract concepts**: information, advice, knowledge, news, research
- **Materials**: equipment, furniture, luggage, rice, water, money
- **Academic fields**: mathematics, physics, economics, statistics
- **Other**: traffic, software, feedback, homework

### Regular Patterns

[](#regular-patterns)

Standard English pluralization rules:

- Add **-s**: cat → cats, dog → dogs
- Add **-es** (s, ss, sh, ch, x, z): bus → buses, church → churches
- Change **-y** to **-ies**: city → cities, category → categories
- Change **-f/-fe** to **-ves**: leaf → leaves, knife → knives
- Add **-es** (consonant + o): hero → heroes, potato → potatoes

Functions
---------

[](#functions)

FunctionReturnsDescription`pluralize( $word, $count )``string`Convert to plural (or singular if count is 1)`singularize( $word )``string`Convert to singular`inflect( $word, $count )``string`Plural if count ≠ 1, singular if count = 1`is_plural( $word )``bool`Check if word is plural`is_singular( $word )``bool`Check if word is singular`is_uncountable( $word )``bool`Check if word is uncountablePerformance
-----------

[](#performance)

The library uses internal caching to optimize repeated operations. Results are cached on first use, making subsequent calls extremely fast.

```
// First call computes and caches
pluralize( 'category' );  // Computed

// Subsequent calls use cache
pluralize( 'category' );  // From cache
```

Requirements
------------

[](#requirements)

- PHP 8.0+

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance45

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (1 commits)")

### Embed Badge

![Health badge](/badges/arraypress-inflector/health.svg)

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

PHPackages © 2026

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