jlinn / caseformat
A PHP case formatting tool inspired by Google Guava's CaseFormat.
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/jlinn/caseformat
Requires
- php: >=5.3.2
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2025-10-11 19:55:42 UTC
README
A PHP case formatting tool inspired by Google Guava's CaseFormat.
Installation Using Composer
Assuming composer.phar is located in your project's root directory, run the following command:
php composer.phar require jlinn/caseformat:~1.0
Usage
The following case formats are supported:
| Format | Example |
|---|---|
| LOWER_HYPHEN | foo-bar |
| LOWER_UNDERSCORE | foo_bar |
| LOWER_CAMEL | fooBar |
| LOWER_SPACE | foo bar |
| UPPER_CAMEL | FooBar |
| UPPER_UNDERSCORE | FOO_BAR |
| UPPER_SPACE | FOO BAR |
Conversion from LOWER_UNDERSCORE to UPPER_CAMEL, for example, is done like so:
use CaseFormat\CaseFormat; $converted = CaseFormat::LOWER_UNDERSCORE("test_string")->to(CaseFormat::UPPER_CAMEL);
In the example above, the value of $converted would be "TestString".