explaingit

doctrine/inflector

11,354PHPAudience · developerComplexity · 2/5Setup · easy

TLDR

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.

Mindmap

mindmap
  root((repo))
    What it does
      Singular to plural
      Plural to singular
      Case conversion
    Use cases
      ORM table names
      URL slugs
      Display labels
    Tech
      PHP library
      Doctrine project
    Audience
      PHP developers
      Framework builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automatically derive database table names from PHP class names in an ORM or custom framework

USE CASE 2

Display item counts with correct English pluralization in a web application interface

USE CASE 3

Convert variable or method names between camelCase and underscored formats in PHP code generation

Tech stack

PHP

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

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.

Copy-paste prompts

Prompt 1
Using Doctrine Inflector in PHP, write a function that takes a model class name like UserProfile and returns the expected database table name user_profiles
Prompt 2
Show me how to use Doctrine Inflector to pluralize and singularize English nouns in a PHP controller that displays item counts
Prompt 3
I'm building a PHP code generator that needs to turn class names into URL slugs, use Doctrine Inflector to handle the camelCase-to-hyphenated conversion
Prompt 4
How do I add Doctrine Inflector to a PHP project via Composer and call the tableize method to get a table name from a class name?
Open on GitHub → Explain another repo

← doctrine on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.