Documentation

Inflector


The inflector helper allows you to transforms words.


camelize(string $string)


Returns a camelized string from a string using underscore syntax.


// "some_text_here" becomes "SomeTextHere"  
echo Inflector::camelize('some_text_here');

underscore(string $string)


Returns a string using underscore syntax from a camelized string.


// "SomeTextHere" becomes "some_text_here"
echo Inflector::underscore('SomeTextHere');

humanize(string $string)


Returns a humanized string from a string using underscore syntax.


// "some_text_here" becomes "Some text here"
echo Inflector::humanize('some_text_here');

ordinalize(integer $number)


Returns ordinalize number.


// 1 becomes 1st
echo Inflector::ordinalize(1);

ordinalize(integer $number)


Returns ordinalize number.


// 1 becomes 1st
echo Inflector::ordinalize(1);

pluralize(integer $word)


Returns the plural version of the given word.


echo Inflector::pluralize('cat');

singularize(integer $word)


Returns the singular version of the given word.


echo Inflector::singularize('cats');