2017 © Pedro Peláez
 

library case-converter

Convert string between Camel Case

image

jawira/case-converter

Convert string between Camel Case

  • Monday, January 29, 2018
  • by jawira
  • Repository
  • 1 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 8 Versions
  • 33 % Grown

The README.md

Case converter

Use this library to convert string between:, (*1)

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:, (*2)

Packagist Version Packagist PHP Version Support Packagist Downloads Packagist License
Maintainability Test Coverage, (*3)

Usage

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

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:, (*5)

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., (*6)

i18n

Fully compatible with non-english alphabets:, (*7)

// 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., (*8)

Installation

composer require jawira/case-converter

Documentation

https://jawira.github.io/case-converter/, (*9)

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., (*10)


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

The Versions

29/01 2018

dev-develop

dev-develop

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • ext-mbstring *
  • php >=5.4

 

29/01 2018

dev-master

9999999-dev

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • ext-mbstring *
  • php >=5.4

 

29/01 2018

v1.1.0

1.1.0.0

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *

 

29/01 2018

dev-release/v1.1.0

dev-release/v1.1.0

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • ext-mbstring *
  • php >=5.4

 

10/11 2017

v1.0.1

1.0.1.0

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-mbstring *

 

30/10 2017

dev-feature/2-add-unit-testing

dev-feature/2-add-unit-testing

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • php >=5.3

 

26/10 2017

v1.0.0

1.0.0.0

Convert string between Camel Case

  Sources   Download

MIT

The Requires

  • php >=5.3

 

25/10 2017

v0.0.0

0.0.0.0

Convert string between Camel Case and Snake Case

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires