This library translate a given string or convention into another convention. The following conventions are supported:
| Convention | Representation |
|---|---|
raw |
A raw string |
words |
['a', 'raw', 'string'] |
title |
A Raw String |
pascalCase |
ARawString |
camelCase |
aRawString |
under_scored |
a_raw_string |
config |
a.raw.string |
constant |
A_RAW_STRING |
composer require ixnode/php-naming-conventionsvendor/bin/php-naming-conventions -Vphp-naming-conventions 0.1.0 (12-18-2022 01:17:26) - Björn Hempel <bjoern@hempel.li>use Ixnode\PhpNamingConventions\NamingConventions;$rawString = 'Group Private';
print (new NamingConventions($rawString))->getTitle();
// (string) Group Private
print (new NamingConventions($rawString))->getPascalCase();
// (string) GroupPrivate
print (new NamingConventions($rawString))->getCamelCase();
// (string) groupPrivate
print (new NamingConventions($rawString))->getUnderscored();
// (string) group_private
print (new NamingConventions($rawString))->getConstant();
// (string) GROUP_PRIVATE
print (new NamingConventions($rawString))->getConfig();
// (string) group.private
print (new NamingConventions($rawString))->getSeparated();
// (string) group-private
print (new NamingConventions($rawString))->getRaw();
// (string) Group Private
print (new NamingConventions($rawString))->getWords();
// (array) [[0] => group, [1] => private]git clone git@github.com:ixnode/php-naming-conventions.git && cd php-naming-conventionscomposer installcomposer testThis tool is licensed under the MIT License - see the LICENSE file for details