synapse / case-convert
Package to convert strings between different cases
v1.0.0
2017-03-10 12:54 UTC
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2025-05-10 23:54:08 UTC
README
PHP Package to convert strings between cases
Usage
Pull in the composer package using the following command:
composer require synapse/case-convert
Then import and use the Str
class.
use Neuron\Str;
$convert = Str::convert('Example test string');
echo $convert->toSnakeCase(); // "example_test_string"
echo $convert->toKebabCase(); // "example-test-string"
echo $convert->toCamelCase(); // "exampleTestString"
echo $convert->toCamelCaseUpperFirstLetter(); // "ExampleTestString"
For one off conversions, you can easily change the to...Case
method onto the convert
method:
Str::convert('example-test-string')->toPlainSentence(); // "Example test string"