Download the PHP package mmucklo/inflect without Composer
On this page you can find all versions of the php package mmucklo/inflect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package inflect
Inflect
Inflect is a memoizing inflector for PHP — pluralize, singularize, and format counted nouns for English.
Requirements
- PHP 8.1+ (the legacy PHP 5.3 baseline is maintained on the
php5.3branch for back-ports)
Installation
Usage
Irregulars, uncountables, and case are handled automatically:
Results are memoized in a process-local static cache.
API
Inflect::pluralize(string $string): string
Returns the plural form of the given word. Empty input returns ''.
Inflect::singularize(string $string): string
Returns the singular form of the given word. Empty input returns ''.
Inflect::pluralizeIf(int $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
Semantic versioning. The currently supported line is 2.x (PHP 8.1+).
See ROADMAP.md for planned work (locale support, extension APIs, etc.).
Upgrading from 1.x
2.0.0 is a breaking release. Highlights:
- PHP 8.1+ required (was 5.3.17+).
src/Inflect/Inflect.phpmoved tosrc/Inflect.php(PSR-0 → PSR-4).Inflectisfinal; rule tables areprivate.pluralize(null)/singularize(null)now throwTypeError.phpunit.xml-distrenamed tophpunit.xml.dist(PHPUnit 10 convention).
Full list in the v2.0.0 release notes.
Contributing
See CONTRIBUTING.md for dev setup, running the test / static analysis / style suite, and PR conventions.
Credits
Originally forked from Sho Kuwamoto's improved pluralizer. Many thanks to Sho, and to the Ruby on Rails and Doctrine inflector projects from which rule patterns continue to be borrowed.
License
MIT — see LICENSE.
