jawira / case-converter
Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.
Requires
- php: ^8.2
- ext-mbstring: *
Requires (Dev)
- behat/behat: ^4.0
- friendsofphp/php-cs-fixer: ^3.95
- jawira/annotation-updater: ^1.1
- jawira/skeleton: ^2.33
- phpstan/phpstan: ^v2.3
- phpunit/phpunit: ^9.6
Suggests
- pds/skeleton: PHP Package Development Standards
- phing/phing: PHP Build Tool
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v3.7.0
- v3.6.0
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.6
- v3.4.5
- v3.4.4
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.2.0
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- v0.0.0
- dev-dependabot
- dev-documentation
- dev-update-code
- dev-update
- dev-remove-code-climate
This package is auto-updated.
Last update: 2026-10-12 18:21:21 UTC
README
Use this library to convert strings between the following cases:
| 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
The input string's format is detected automatically.
For example:
use Jawira\CaseConverter\Convert; $hero = new Convert('john-connor'); echo $hero->toCamel(); // output: johnConnor
You can also specify the input string's format explicitly:
echo $hero->fromKebab()->toSnake(); // output: john_connor
You can also use the provided factory to create a Convert instance.
See the list of all public methods for more options.
i18n
The library supports 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 supports both 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.
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...