doctrine/inflector
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The Doctrine Inflector is a PHP library designed for string manipulation. This package handles transformation of words' case to either uppercase or lowercase and it is especially powerful in converting words between their singular and plural forms, making it an invaluable tool for handling word-based data more efficiently in PHP applications. This capability is commonly required when dealing with database table names and class names, among other programming use-cases.
Using Doctrine Inflector in your PHP application is straightforward. Assuming you have composer installed, the first step is to include it in your project by running composer require doctrine/inflector
. The library provides a simple API for transforming text:
use Doctrine\Inflector\InflectorFactory;
$inflector = InflectorFactory::create()->build();
echo $inflector->tableize('MyClassName'); // outputs "my_class_name"
echo $inflector->classify('my_class_name'); // outputs "MyClassName"
echo $inflector->pluralize('property'); // outputs "properties"
echo $inflector->singularize('properties'); // outputs "property"
In these examples, the tableize
method converts 'MyClassName' into 'my_class_name' and the classify
method does the opposite. The pluralize
and singularize
methods transform 'property' to 'properties' and 'properties' to 'property' respectively.
The rich documentation for Doctrine Inflector is included in the README file of the package's GitHub repository. This should guide users in different use-cases and scenarios of utilizing the package. No other official external documentation sites exist for this package. For further information, insights, and use-cases you can check the repository and explore the code itself, as well as engage with the community of contributors and users on the GitHub page at https://github.com/doctrine/inflector.