承接 jawira/case-converter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jawira/case-converter

最新稳定版本:v3.6.0

Composer 安装命令:

composer require 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.

README 文档

README

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:

Packagist Version Packagist PHP Version Support Packagist Downloads Packagist License
Maintainability Test Coverage

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

  • If you liked this project, ⭐ star it on GitHub. GitHub Repo stars
  • Or follow me on X. Twitter Follow

License

This library is licensed under the MIT LICENSE.

Packages from jawira

jawira/emoji-catalog GitHub stars
Get access to +3000 emojis as class constants.
jawira/plantuml-client GitHub stars
Convert PlantUML diagrams into images (svg, png, ...).
jawira/doctrine-diagram-bundle GitHub stars
Symfony Bundle to generate database diagrams.
more...

统计信息

  • 总下载量: 6.31M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 181
  • 点击次数: 1
  • 依赖项目数: 85
  • 推荐数: 3

GitHub 信息

  • Stars: 174
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04