Download the PHP package icanboogie/inflector without Composer
On this page you can find all versions of the php package icanboogie/inflector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download icanboogie/inflector
More information about icanboogie/inflector
Files in icanboogie/inflector
Package inflector
Short Description Multilingual inflector that transforms words from singular to plural, underscore to camel case, and more.
License BSD-3-Clause
Homepage https://icanboogie.org/
Informations about the package inflector
Inflector
A multilingual inflector that transforms words from singular to plural, underscore to camel case, and formats strings in various ways. Inflections are localized, the default English inflections for pluralization, singularization, and uncountable words are kept in lib/Inflections/en.php.
Inflections are currently available for the following languages:
- English (
en
) - French (
fr
) - Norwegian Bokmal (
nb
) - Portuguese (
pt
) - Spanish (
es
) - Turkish (
tr
)
Installation
Usage
These are some examples of the inflector with the en
locale (default).
Static interfaces are also available:
[!WARNING] Since v3.0 the file with the helper functions is no longer included in the autoload. You need to include the file
vendor/icanboogie/inflector/lib/helpers.php
in yourcomposer.json
if you want to continue using these functions.
About inflections
Inflections are localized, the configurators are kept in lib/Inflections/.
[!TIP] Since v2.1, these configurators are autoloaded classes, which means, in theory, you could add your own or overwrite those already defined by specifying another
ICanBoogie\\Inflections\\
in yourcomposer.json
file.
Acknowledgements
Most of the code and documentation was adapted from Ruby On Rails's Inflector and David Celis' inflections.
Significant differences:
- Better support of accented characters.
- The Ruby module separator
::
as been replaced by the PHP namespace separator\
. - The plural of "octopus" is "octopuses" (not "octopi"), the plural of "virus" is "viruses" (not viri), and the plural of "cow" is "cows" (not "kine").
- The following methods have been removed:
tableize
,classify
,demodulize
,constantize
,deconstantize
andforeign_key
. They can be easily implemented in specific inflectors. - Added the
hyphenate
method, which is a combination ofunderscore
anddasherize
. - One specifies
true
rather thanfalse
tocamelize()
to downcase the first letter of the camel-cased string.
Getting started
Inflector expects to work in UTF-8, which is the default encoding character set starting
PHP 5.6, if your configuration is different, use mb_internal_encoding()
as follows:
Continuous Integration
The project is continuously tested by GitHub actions.
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.
All versions of inflector with dependencies
ext-mbstring Version *