intellex/naming-convention

Installs: 4

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/intellex/naming-convention

1.1.0 2025-11-02 17:08 UTC

This package is auto-updated.

Last update: 2025-12-02 17:20:25 UTC


README

Small library to detect and convert between naming conventions.

Convention Examples
NamingConvention::CAMEL_CASE camel, myVarName
NamingConvention::SNAKE_CASE snake, my_var_name
NamingConvention::SCREAMING_SNAKE_CASE SNAKE, MY_VAR_NAME
NamingConvention::PASCAL_CASE Pascal, MyVarName
NamingConvention::KEBAB_CASE kebab my-var-name

Usage

Via composer: composer require intellex/naming-convention

use Intellex\NamingConvention\NamingConvention

# Validate
NamingConvention::CAMEL_CASE->validate('myVarName');  // true
NamingConvention::SNAKE_CASE->validate('Snake_Case'); // false

# Detect the convention
$varName =  NamingConvention::determineApplicableConvention('my_var_name');
$varName->convention // NamingConvention::SNAKE_CASE

# Convert
$newName = $varName->convertTo(NamingConvention::PASCAL_CASE);
$newName->name       // "MyVarName"

Related projects

This library is developed for the automated data parsing library.

License

Licenced under MIT Licence.

Credits

Written by the Intellex team.