PHPackages                             originphp/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. originphp/inflector

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

originphp/inflector
===================

OriginPHP Inflector

2.0.0(5y ago)012.3k↓73.3%9MITPHPPHP &gt;=7.3.0CI failing

Since Oct 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/originphp/inflector)[ Packagist](https://packagist.org/packages/originphp/inflector)[ Docs](https://www.originphp.com)[ RSS](/packages/originphp-inflector/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (7)Used By (9)

Inflector
=========

[](#inflector)

[![license](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)[![build](https://github.com/originphp/inflector/workflows/CI/badge.svg)](https://github.com/originphp/inflector/actions)[![coverage](https://camo.githubusercontent.com/f7eb0628a4e1d410d58bddbe15661a83ddfb3e43655c3d17f560ad03ad188e94/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f726967696e7068702f696e666c6563746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/originphp/inflector?branch=master)

The Inflector class changes words from singular to plural or vice versa, and it also changes cases of words as well.

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

[](#installation)

To install this package

```
$ composer require originphp/inflector

```

Converting Singular &amp; Plural
--------------------------------

[](#converting-singular--plural)

To convert words to their singular or plural form

### Converting

[](#converting)

```
use Origin\Inflector\Inflector;

$singular = Inflector::singular('apples'); // apple
$plural = Inflector::plural('apple'); // apples
```

### Rules

[](#rules)

The Inflector comes with a some standard rules which cover most words and is a good starting point for a project, however occasionally you might need to add a custom rule.

In your bootstrap/configuration

```
use Origin\Inflector\Inflector;

// regex or string
Inflector::rules('singular',[
    '/(quiz)zes$/i' => '\\1'
]);

// regex or string
Inflector::rules('plural',[
    '/(quiz)$/i' => '\1zes'
]);

// string only
Inflector::rules('uncountable',['sheep']);

// string only
Inflector::rules('irregular',[
    'child' => 'children'
]);
```

Singular and plural rules can be both strings or regex expressions

```
use Origin\Inflector\Inflector;

Inflector::rules('singular',['fezzes'=>'fez']);
Inflector::rules('plural',['fez'=>'fezzes']);
```

Changing Cases
--------------

[](#changing-cases)

To change cases of words

```
use Origin\Inflector\Inflector;

// change underscored words
$studyCaps = Inflector::studlyCaps('big_tree') ; // BigTree
$camelCase = Inflector::camelCase('big_tree') ; // bigTree
$human = Inflector::human('big_tree'); // Big Tree

// Change studly capped words
$underscored = Inflector::underscored('BigTree'); // big_tree
```

The Inflector also has these two methods which OriginPHP also uses to do its magic.

```
// converts class name into into table name (plural underscored)
$tableName = Inflector::tableName('BigTree'); // big_trees

// converts table names (plural underscored) into a class name
$className = Inflector::className('big_trees'); // BigTree
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~89 days

Recently: every ~108 days

Total

6

Last Release

1957d ago

Major Versions

1.0.4 → 2.0.02021-01-04

PHP version history (3 changes)1.0.0PHP ^7.2.0

1.0.4PHP &gt;=7.2.0

2.0.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e8a821333d9c7b7bc2ad3d164d142f65cd3912dea78033d31f76b0f19ba8a0c?d=identicon)[originphp](/maintainers/originphp)

---

Top Contributors

[![jamielsharief](https://avatars.githubusercontent.com/u/20553479?v=4)](https://github.com/jamielsharief "jamielsharief (23 commits)")

---

Tags

pluralinflectorinflectionsingularunderscorecamel casecamelcaseoriginPHPstudly caps

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  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.4k855.8M711](/packages/doctrine-inflector)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.3M7](/packages/wapmorgan-morphos)[jawira/case-converter

Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.

1746.9M79](/packages/jawira-case-converter)[maciejczyzewski/bottomline

A full-on PHP manipulation utility belt that provides support for working with arrays, objects, and iterables; a lodash or underscore equivalent for PHP.

477631.4k10](/packages/maciejczyzewski-bottomline)[mmucklo/inflect

inflect - a memoizing inflector for php

4023.1M13](/packages/mmucklo-inflect)[mattketmo/camel

Tiny library to handle words case transformation

29357.0k17](/packages/mattketmo-camel)

PHPackages © 2026

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