Inflector ​
- Type
- Class
- Namespace
- craft\helpers
- Inherits
- craft\helpers\Inflector » yii\helpers\Inflector » yii\helpers\BaseInflector
- Since
- 5.4.0
Public Properties ​
Property | Description |
---|---|
plurals | array – The rules for converting a word into its plural form. |
singulars | array – The rules for converting a word into its singular form. |
specials | array – The special rules for converting a word between its plural form and singular form. |
transliteration | array – Fallback map for transliteration used by transliterate() when intl isn't available. |
transliterator | mixed – Either a Transliterator, or a string from which a Transliterator can be built for transliteration. |
Public Methods ​
Method | Description |
---|---|
camel2id() | Converts a CamelCase name into an ID in lowercase. |
camel2words() | Converts a CamelCase name into space-separated words. |
camelize() | Returns given word as CamelCased. |
classify() | Converts a table name to its class name. |
humanize() | Returns a human-readable string from $word. |
id2camel() | Converts an ID into a CamelCase name. |
ordinalize() | Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd . |
pluralize() | Converts a word to its plural form. |
sentence() | |
singularize() | Returns the singular of the $word. |
slug() | Returns a string with all spaces converted to given replacement, non word characters removed and the rest of characters transliterated. |
tableize() | Converts a class name to its table name (pluralized) naming conventions. |
titleize() | Converts an underscored or CamelCase word into a English sentence. |
transliterate() | Returns transliterated version of a string. |
underscore() | Converts any "CamelCased" into an "underscored_word". |
variablize() | Same as camelize but first char is in lowercase. |
sentence()
​
Arguments ​
$words
$twoWordsConnector
$lastWordConnector
$connector
Protected Methods ​
Method | Description |
---|---|
hasIntl() |
Constants ​
Constant | Description |
---|---|
TRANSLITERATE_LOOSE | Shortcut for Any-Latin; Latin-ASCII; [\u0080-\uffff] remove transliteration rule. |
TRANSLITERATE_MEDIUM | Shortcut for Any-Latin; Latin-ASCII transliteration rule. |
TRANSLITERATE_STRICT | Shortcut for Any-Latin; NFKD transliteration rule. |