Description
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.
Case converter alternatives and similar libraries
Based on the "Strings" category.
Alternatively, view Case converter alternatives based on common mentions on social networks and blogs.
-
Mobile-Detect
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment. -
SQL Formatter
A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting. -
Device Detector
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model. -
Slugify
Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte. -
Jieba-PHP
"結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件。 / "Jieba" (Chinese for "to stutter") Chinese text segmentation: built to be the best PHP Chinese word segmentation module. -
URLify
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs. -
Google Translate For Free
Library for free use Google Translator. With attempts connecting on failure and array support. -
Russian metaphone phonetic algorithm implementation for PHP
Russian metaphone algorithm implementation
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Case converter or a related project?
README
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() |
my.name.is.bond |
Features:
Usage
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.
i18n
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.
Installation
composer require jawira/case-converter
Documentation
https://jawira.github.io/case-converter/
Contributing
License
This library is licensed under the MIT LICENSE.
<!--mkdocs: Do not use relative path for links and images-->
Packages from jawira
jawira/emoji-catalog Get access to +3000 emojis as class constants.
jawira/plantuml-client Convert PlantUML diagrams into images (svg, png, ...).
jawira/doctrine-diagram-bundle Symfony Bundle to generate database diagrams.
more...
*Note that all licence references and agreements mentioned in the Case converter README section above
are relevant to that project's source code only.