PHPackages                             mmucklo/inflect - 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. mmucklo/inflect

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

mmucklo/inflect
===============

inflect - a memoizing inflector for php

v2.0.0(1mo ago)4024.1M↓48.6%7[1 PRs](https://github.com/mmucklo/inflect/pulls)14MITPHPPHP &gt;=8.1CI passing

Since Jul 15Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/mmucklo/inflect)[ Packagist](https://packagist.org/packages/mmucklo/inflect)[ RSS](/packages/mmucklo-inflect/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (11)Used By (14)

Inflect
=======

[](#inflect)

[![CI](https://github.com/mmucklo/inflect/actions/workflows/ci.yml/badge.svg)](https://github.com/mmucklo/inflect/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/84c53d829fac774426e793dd533d8935505879ac2bbbd6290577731bebba9f81/68747470733a2f2f636f6465636f762e696f2f67682f6d6d75636b6c6f2f696e666c6563742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/mmucklo/inflect)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ab37fb0be36e90181cb8ae4ba418d8b37c5d3d696320fb40b0982d9e509a7ceb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6d75636b6c6f2f696e666c6563742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mmucklo/inflect/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/18ea5afa8660ad6e6d797bbac8ff59d135667ae73595df89ba9aa9121a71c2c7/68747470733a2f2f706f7365722e707567782e6f72672f6d6d75636b6c6f2f696e666c6563742f76)](https://packagist.org/packages/mmucklo/inflect)[![License](https://camo.githubusercontent.com/53ddf95c340789892ad424068e0dcd20eb7ec812e6e1b49fdf431aae1f616b8a/68747470733a2f2f706f7365722e707567782e6f72672f6d6d75636b6c6f2f696e666c6563742f6c6963656e7365)](https://packagist.org/packages/mmucklo/inflect)

Inflect is a memoizing inflector for PHP — pluralize, singularize, and format counted nouns for English.

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

[](#requirements)

- PHP **8.1+** (the legacy PHP 5.3 baseline is maintained on the [`php5.3`](https://github.com/mmucklo/inflect/tree/php5.3) branch for back-ports)

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

[](#installation)

```
composer require mmucklo/inflect
```

Usage
-----

[](#usage)

```
use Inflect\Inflect;

Inflect::pluralize('test');        // 'tests'
Inflect::singularize('tests');     // 'test'
Inflect::pluralizeIf(1, 'cat');    // '1 cat'
Inflect::pluralizeIf(3, 'person'); // '3 people'
```

Irregulars, uncountables, and case are handled automatically:

```
Inflect::pluralize('Man');         // 'Men'
Inflect::pluralize('datum');       // 'data'
Inflect::pluralize('news');        // 'news'
Inflect::singularize('criteria');  // 'criterion'
Inflect::singularize('Children');  // 'Child'

// Double-inflection is a no-op:
Inflect::pluralize('people');      // 'people'
Inflect::singularize('datum');     // 'datum'
```

Results are memoized in a process-local static cache.

API
---

[](#api)

### `Inflect::pluralize(string $string): string`

[](#inflectpluralizestring-string-string)

Returns the plural form of the given word. Empty input returns `''`.

### `Inflect::singularize(string $string): string`

[](#inflectsingularizestring-string-string)

Returns the singular form of the given word. Empty input returns `''`.

### `Inflect::pluralizeIf(int $count, string $string): string`

[](#inflectpluralizeifint-count-string-string-string)

Returns `"$count $word"` with the word pluralized when `$count !== 1`.

Passing `null` to any of these methods raises a `TypeError` — callers should handle null explicitly.

Versioning
----------

[](#versioning)

Semantic versioning. The currently supported line is **2.x** (PHP 8.1+).

See [CHANGELOG.md](CHANGELOG.md) for release history and [ROADMAP.md](ROADMAP.md) for planned work (locale support, extension APIs, etc.).

Upgrading from 1.x
------------------

[](#upgrading-from-1x)

2.0.0 is a breaking release. Highlights:

- PHP 8.1+ required (was 5.3.17+).
- `src/Inflect/Inflect.php` moved to `src/Inflect.php` (PSR-0 → PSR-4).
- `Inflect` is `final`; rule tables are `private`.
- `pluralize(null)` / `singularize(null)` now throw `TypeError`.
- `phpunit.xml-dist` renamed to `phpunit.xml.dist` (PHPUnit 10 convention).

Full list in the [v2.0.0 release notes](https://github.com/mmucklo/inflect/releases/tag/v2.0.0).

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for dev setup, running the test / static analysis / style suite, and PR conventions.

Credits
-------

[](#credits)

Originally forked from Sho Kuwamoto's [improved pluralizer](http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/). Many thanks to Sho, and to the Ruby on Rails and Doctrine inflector projects from which rule patterns continue to be borrowed.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

67

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community23

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% 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 ~1164 days

Total

5

Last Release

58d ago

Major Versions

v0.3.0 → v2.0.02026-04-13

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.17

v2.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![mmucklo](https://avatars.githubusercontent.com/u/245122?v=4)](https://github.com/mmucklo "mmucklo (23 commits)")[![alecsammon](https://avatars.githubusercontent.com/u/304636?v=4)](https://github.com/alecsammon "alecsammon (1 commits)")

---

Tags

inflectorinflecturlifysingularizepluralize

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mmucklo-inflect/health.svg)

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

###  Alternatives

[doctrine/inflector

PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.

11.4k885.0M821](/packages/doctrine-inflector)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6947.8M75](/packages/jbroadway-urlify)[icanboogie/inflector

Multilingual inflector that transforms words from singular to plural, underscore to camel case, and more.

2182.5M71](/packages/icanboogie-inflector)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

254.2M8](/packages/voku-urlify)

PHPackages © 2026

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