nayjest / str-case-converter
Library for converting strings from camel case to snake case and vice versa.
Installs: 388 907
Dependents: 14
Suggesters: 0
Security: 0
Stars: 12
Watchers: 4
Forks: 0
Open Issues: 2
Requires
- php: >=5
Requires (Dev)
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-10-11 15:59:59 UTC
README
Library for converting strings from camel case to snake case and vice versa.
Installation
The recommended way of installing the library is through Composer.
Run following command:
composer require nayjest/str-case-converter
Usage
Converting from snake case to camel case
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.
Converting from camel case to snake case
use Nayjest\StrCaseConverter\Str; ... echo Str::toSnakeCase('MyString'); // 'my_string' // It's possible to use custom delimiter: echo Str::toSnakeCase('OneMoreString', '-'); // 'one-more-string'
Testing
Run following command:
phpunit
License
© 2015—2023 Vitalii Stepanenko
Licensed under the MIT License.
Please see License File for more information.