Library for converting strings from camel case to snake case and vice versa
MIT License
Library for converting strings from camel case to snake case and vice versa.
The recommended way of installing the library is through Composer.
Run following command:
composer require nayjest/str-case-converter
use Nayjest\StrCaseConverter\Str;
...
echo Str::toCamelCase('my-string'); // 'MyString'
echo Str::toCamelCase('one_more_string'); // 'OneMoreString'
Source string may be separated to words using following characters: '-', '_' and space.
use Nayjest\StrCaseConverter\Str;
...
echo Str::toSnakeCase('MyString'); // 'my_string'
// It's possible to use custom delimiter:
echo Str::toSnakeCase('OneMoreString', '-'); // 'one-more-string'
Run following command:
phpunit
© 2015—2023 Vitalii Stepanenko
Licensed under the MIT License.
Please see License File for more information.