synapse/case-convert

Package to convert strings between different cases

v1.0.0 2017-03-10 12:54 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:20:14 UTC


README

Build Status

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"