mattketmo/camel
Laravel-friendly utilities for converting strings, keys, and arrays between camelCase, snake_case, StudlyCase and more. Handy for normalizing request/response payloads, config keys, and API data with simple helpers and minimal setup.
Tiny library to handle words case transformation.
The main idea is to split the given word into several words and assemble them in another format.
Example: camelCase => [camel, Case] => camel_case
composer require mattketmo/camel
<?php
require __DIR__.'/vendor/autoload.php';
use Camel\CaseTransformer;
use Camel\Format;
$transformer1 = new CaseTransformer(new Format\SnakeCase, new Format\CamelCase);
$transformer2 = new CaseTransformer(new Format\CamelCase, new Format\ScreamingSnakeCase);
echo $transformer1->transform('hello_world'); // helloWorld
echo $transformer2->transform('helloWorld'); // HELLO_WORLD
camelCaseStudlyCapssnake_caseSCREAMING_SNAKE_CASEspinal-caseInstall phpunit via Composer:
composer install
Once installed, run the following command:
vendor/bin/phpunit
Camel is released under the MIT License. See the bundled LICENSE file for details.
How can I help you explore Laravel packages today?