Skip to content
Convert strings between 13 naming conventions: Snake case, Camel case, Kebab case, Pascal case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Title case, Sentence case and Dot notation.
PHP Gherkin
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea/dictionaries Update gitattributes file Jul 21, 2019
config Removing Markdown-lint config files Jul 18, 2019
docs Update docs Aug 29, 2019
src Improve `Dot notation` documentation #46 Aug 18, 2019
tests Add Dot notation #46 Aug 17, 2019
.codeclimate.yml #22 Add code climate plugin file Mar 30, 2019
.editorconfig Preparing for v3.3.0 Aug 21, 2019
.gitattributes Update gitattributes file Jul 21, 2019
.gitignore Create image directory for documentation Jul 19, 2019
.travis.yml Fix disappearing zero #44 Jul 24, 2019 Preparing v3.3.3 Sep 3, 2019 Fix: supporting greek, cyrillic, and other special characters Oct 5, 2018 Preparing v3.3.3 Sep 3, 2019
build.xml Preparing for v3.3.0 Aug 21, 2019
composer.json Preparing for v3.3.1 Aug 21, 2019
mkdocs.yml Add Dot notation #46 Aug 17, 2019
phive.xml Update docs Aug 29, 2019

Case converter

Use this library to convert string between:

Name Method Output example
🐪 Camel case toCamel() myNameIsBond
👨‍🏫 Pascal case toPascal() MyNameIsBond
🐍 Snake case toSnake() my_name_is_bond
👩‍🏫 Ada case toAda() My_Name_Is_Bond
Ⓜ️ Macro case toMacro() MY_NAME_IS_BOND
🥙 Kebab case toKebab() my-name-is-bond
🚂 Train case toTrain() My-Name-Is-Bond
🏦 Cobol case toCobol() MY-NAME-IS-BOND
🔡 Lower case toLower() my name is bond
🔠 Upper case toUpper() MY NAME IS BOND
📰 Title case toTitle() My Name Is Bond
✍️ Sentence case toSentence() My name is bond
⚙️ Dot notation toDot()


Latest Stable Version PHP from Packagist Build Status Maintainability Test Coverage Total Downloads Monthly Downloads Daily Downloads PHPPackages Rank PHPPackages Referenced By License composer.lock PDS Skeleton Issues


Input string (i.e. john-connor) format is going to be detected automatically. Here's an example:

use Jawira\CaseConverter\Convert;

$hero = new Convert('john-connor');

echo $hero->toCamel();   // output: johnConnor

Of course you can explicitly set the format of input string:

echo $hero->fromKebab()->toSnake();   // output: john_connor

You can also use the provided factory to instantiate Convert class. A list of all public methods is also available.


Fully compatible with non-english alphabets:

// Spanish
$esp = new Convert('DON_RAMÓN_Y_ÑOÑO');
echo $esp->toCamel();   // output: donRamónYÑoño

// Greek
$grc = new Convert('πολύ-Καλό');
echo $grc->toCamel();   // output: πολύΚαλό

// Russian
$rus = new Convert('ОЧЕНЬ_ПРИЯТНО');
echo $rus->toCamel();   // output: оченьПриятно

case-converter is compatible with Simple Case-Mapping and Full Case-Mapping. Learn more about Case-Mapping.


$ composer require jawira/case-converter



If you liked this project, ⭐ star it on GitHub.


This library is licensed under the MIT LICENSE.

My other packages

jawira/phing-visualizer (library)
Graphical representation of Phing's buildfile.
jawira/phing-open-task (library)
Phing task to open files, directories, and URLs with your favorite software.
jawira/plantuml (library)
Provides PlantUML integration: plantuml executable and plantuml.jar
jawira/plantuml-encoding (library)
PlantUML encoding functions.
jawira/process-maker (project)
Easily install and try ProcessMaker using Docker Compose.
You can’t perform that action at this time.