mattketmo/camel

Tiny library to handle words case transformation

Maintainers

👁 MattKetmo

Package info

github.com/MattKetmo/camel

pkg:composer/mattketmo/camel

Statistics

Installs: 378 977

Dependents: 28

Suggesters: 0

Stars: 29

Open Issues: 0

v1.1.0 2015-05-13 13:51 UTC

Requires

None

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 2d7753c62787933f6761108acc76f95d8bfee191

  • Matthieu Moquet <matthieu.woop@moquet.net>

transformcasecamelcasesnakecaselowercase

This package is auto-updated.

Last update: 2026-06-05 23:16:34 UTC


README

👁 Build status...
👁 Code quality...
👁 License MIT
👁 Packagist

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

Installation

composer require mattketmo/camel

Usage

<?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

Supported formats

  • camelCase
  • StudlyCaps
  • snake_case
  • SCREAMING_SNAKE_CASE
  • spinal-case

Unit Tests

Install phpunit via Composer:

composer install

Once installed, run the following command:

vendor/bin/phpunit

License

Camel is released under the MIT License. See the bundled LICENSE file for details.