ixnode/php-naming-conventions

PHP Naming Conventions

0.1.3 2024-07-18 20:21 UTC

This package is auto-updated.

Last update: 2024-11-18 21:00:48 UTC


README

Release PHP PHPStan PHPUnit PHPCS PHPMD Rector - Instant Upgrades and Automated Refactoring LICENSE

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

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

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]

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