inflector
Doctrine Inflector is a small library that can perform string manipulations with regard to uppercase/lowercase and singular/plural forms of words.
A small PHP library that converts English words between singular and plural forms and transforms text between casing styles like camelCase and underscored format, commonly used inside PHP frameworks and ORMs.
Doctrine Inflector is a small PHP library that handles two common text transformation tasks: changing the case of words (uppercase versus lowercase, camelCase versus underscored formats) and converting between singular and plural forms of English words.
This kind of functionality is a recurring need in web applications. A framework or ORM (object-relational mapper, software that connects code objects to database tables) often needs to automatically derive a table name from a class name, or display a count of items using the correct grammatical form. Rather than writing and maintaining that logic in every project, Inflector provides it in a dedicated library.
The library is part of the Doctrine project, a collection of PHP libraries best known for its database tools. Because Doctrine's ORM and related libraries use Inflector internally, it ends up as a dependency in many PHP projects even when developers have not explicitly chosen it. Its high star count likely reflects this widespread indirect usage across the PHP ecosystem.
The README for this project is very brief and describes the library in a single sentence. It provides no usage examples, installation instructions, or documentation beyond that description and a pair of build status badges. Anyone looking for detailed documentation would need to consult the Doctrine project's broader documentation resources.
Where it fits
- Automatically derive database table names from PHP class names in an ORM or custom framework
- Display item counts with correct English pluralization in a web application interface
- Convert variable or method names between camelCase and underscored formats in PHP code generation