Skip to content

API

List of public methods.

\Jawira\CaseConverter\Convert

String conversion

Method Description
toCamel() Return string in Camel case format
toPascal() Return string in Pascal case format
toSnake() Return string in Snake case format
toAda() Return string in Ada case format
toMacro() Return string in Macro case format
toKebab() Return string in Kebab case format
toTrain() Return string in Train case format
toCobol() Return string in Cobol case format
toLower() Return string in Lower case format
toUpper() Return string in Upper case format
toTitle() Return string in Title case format
toSentence() Return string in Sentence case format
toDot() Return string in Dot notation

Explicit case detection

Method Description
fromAuto() (default) Auto-detect naming convention
fromCamel() Split input string using uppercase characters
fromPascal() Split input string using uppercase characters
fromSnake() Split input string using _ (underscore character)
fromAda() Split input string using _ (underscore character)
fromMacro() Split input string using _ (underscore character)
fromKebab() Split input string using - (dash character)
fromTrain() Split input string using - (dash character)
fromCobol() Split input string using - (dash character)
fromLower() Split input string using (space character)
fromUpper() Split input string using (space character)
fromTitle() Split input string using (space character)
fromSentence() Split input string using (space character)
fromDot() Split input string using . (dot character)

Please note that some methods are equivalent and have the same effect:

  • fromDot()
  • fromCamel()fromPascal()
  • fromSnake()fromAda()fromMacro()
  • fromKebab()fromTrain()fromCobol()
  • fromLower()fromUpper()fromTitle()fromSentence()

All these methods exists only for sake of completeness.

Utility methods

Method Description
getSource() Returns original input string
toArray() Returns array with detected words
forceSimpleCaseMapping() Output sting uses Simple Case-Mapping even if you are using PHP 7.3 or newer

\Jawira\CaseConverter\CaseConverter

Factory method

Method Description
convert() Creates a Convert object