Skip to content

Repository files navigation

PHP Naming Conventions

ReleasePHPPHPStanPHPUnitPHPCSPHPMDRector - Instant Upgrades and Automated RefactoringLICENSE

This library translate a given string or convention into another convention. The following conventions are supported:

ConventionRepresentation
rawA raw string
words['a', 'raw', 'string']
titleA Raw String
pascalCaseARawString
camelCaseaRawString
under_scoreda_raw_string
configa.raw.string
constantA_RAW_STRING

Installation

composer require ixnode/php-naming-conventions
vendor/bin/php-naming-conventions -V
php-naming-conventions 0.1.0 (12-18-2022 01:17:26) - Björn Hempel <bjoern@hempel.li>

Usage

useIxnode\PhpNamingConventions\NamingConventions;
$rawString = 'Group Private';
print (newNamingConventions($rawString))->getTitle();
// (string) Group Privateprint (newNamingConventions($rawString))->getPascalCase();
// (string) GroupPrivateprint (newNamingConventions($rawString))->getCamelCase();
// (string) groupPrivateprint (newNamingConventions($rawString))->getUnderscored();
// (string) group_privateprint (newNamingConventions($rawString))->getConstant();
// (string) GROUP_PRIVATEprint (newNamingConventions($rawString))->getConfig();
// (string) group.privateprint (newNamingConventions($rawString))->getSeparated();
// (string) group-privateprint (newNamingConventions($rawString))->getRaw();
// (string) Group Privateprint (newNamingConventions($rawString))->getWords();
// (array) [[0] => group, [1] => private]

Development

git clone git@github.com:ixnode/php-naming-conventions.git &&cd php-naming-conventions
composer install
composer test

License

This tool is licensed under the MIT License - see the LICENSE file for details

About

PHP Naming Conventions

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages