PHPackages                             realodix/change-case - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. realodix/change-case

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

realodix/change-case
====================

Convert strings between camelCase, PascalCase, Headline Case, snake\_case and more.

v4.2.4(1mo ago)244.3k↑1608.3%MITPHPPHP ^8.1CI passing

Since Jun 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/realodix/change-case)[ Packagist](https://packagist.org/packages/realodix/change-case)[ Docs](https://github.com/realodix/change-case)[ RSS](/packages/realodix-change-case/feed)WikiDiscussions 4.x Synced yesterday

READMEChangelog (10)Dependencies (14)Versions (42)Used By (0)

Change Case
===========

[](#change-case)

[![PHPVersion](https://camo.githubusercontent.com/e4c746e57dc67e57b1e7b43b829cb475d3d840e50764be0f18b7222590e107a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253230382e312d3737374242342e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e4c746e57dc67e57b1e7b43b829cb475d3d840e50764be0f18b7222590e107a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253230382e312d3737374242342e7376673f7374796c653d666c61742d737175617265)[![Tests](https://github.com/realodix/change-case/actions/workflows/tests.yml/badge.svg)](https://github.com/realodix/change-case/actions/workflows/tests.yml/badge.svg)[![GitHub license](https://camo.githubusercontent.com/8804fa628ebb71bac2f2090fc081521b7bbe6fb218ce5f8f49578c01209e3185/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7265616c6f6469782f6368616e67652d63617365)](/LICENSE)

> Transform a string between `camelCase`, `PascalCase`, `Headline Case`, `snake_case`, `param-case`, `CONSTANT_CASE` and others.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require realodix/change-case
```

Usage
-----

[](#usage)

```
use Realodix\ChangeCase\ChangeCase;
```

### Methods Available

[](#methods-available)

- [`camelCase`](#camelcase)
- [`CONSTANT_CASE`](#constant_case)
- [`dot.case`](#dotcase)
- [`Header-Case`](#header-case)
- [`Headline Case`](#headline-case)
- [`kebab-case`](#kebab-case)
- [`no case`](#no-case)
- [`PascalCase`](#pascalcase)
- [`path/case`](#pathcase)
- [`Sentence case`](#sentence-case)
- [`snake_case`](#snake_case)
- [`swapCase`](#swapcase)

### Options

[](#options)

Every method that gets 💡 flag, they can support option

- `delimiter`: (string) This character separates each chunk of data within the text string. Default: singgle space.
- `splitRx`: (RegExp) Used to split into word segments.
- `stripRx`: (RegExp) Used to remove extraneous characters.
- `separateNum`: (bool) Used to separate numbers or not. Default: false.
- `apostrophe`: (bool) Used to separate apostrophe or not. Default: false.

Examples

```
ChangeCase::header('TestV2', ['separateNum' => true]);
// 'Test-V-2'
```

#### camelCase

[](#camelcase)

> Transform into a string with the separator denoted by the next word capitalized.

💡 Support [options](#options)

```
ChangeCase::camel('test string');
// 'testString'

ChangeCase::camel('1twoThree');
// '1twoThree'
ChangeCase::camel('1twoThree', ['separateNum' => true]);
// '1TwoThree'
```

#### CONSTANT\_CASE

[](#constant_case)

> Transform into upper case string with an underscore between words.

```
ChangeCase::constant('test string');
// 'TEST_STRING'
```

#### dot.case

[](#dotcase)

> Transform into a lower case string with a period between words.

💡 Support [options](#options)

```
ChangeCase::dot('test string');
// 'test.string'
```

#### Header-Case

[](#header-case)

> Transform into a dash separated string of capitalized words.

💡 Support [options](#options)

```
ChangeCase::header('test string');
// 'Test-String'
```

#### Headline Case

[](#headline-case)

> Transform a strings delimited by casing, hyphens, or underscores into a space delimited string with each word's first letter capitalized.

```
ChangeCase::headline('test string');
// 'Test String'
ChangeCase::headline('steve_jobs');
// Steve Jobs
ChangeCase::headline('EmailNotificationSent');
// Email Notification Sent
```

#### kebab-case

[](#kebab-case)

> Transform into a lower cased string with dashes between words.

💡 Support [options](#options)

```
ChangeCase::kebab('test string');
// 'test-string'

ChangeCase::kebab('Foo123Bar');
// 'foo123-bar'
ChangeCase::kebab('Foo123Bar', ['separateNum' => true]);
// 'foo-123-bar'
```

#### no case

[](#no-case)

> Transform into a lower cased string with spaces between words, and clean up the string from non-word characters.

💡 Support [options](#options)

```
ChangeCase::no('testString');
// 'test string'

ChangeCase::no('Foo123Bar')
// foo123 bar
ChangeCase::no('Foo123Bar', ['separateNum' => true])
// foo 123 bar
```

#### PascalCase

[](#pascalcase)

> Transform into a string of capitalized words without separators.

💡 Support [options](#options)

```
ChangeCase::pascal('test string');
// 'TestString'
```

#### path/case

[](#pathcase)

> Transform into a lower case string with slashes between words.

💡 Support [options](#options)

```
ChangeCase::path('test string');
// 'test/string'
```

#### Sentence case

[](#sentence-case)

> Transform into a lower case with spaces between words, then capitalize the string.

💡 Support [options](#options)

```
ChangeCase::sentence('testString');
// 'Test string'
```

#### snake\_case

[](#snake_case)

> Transform into a lower case string with underscores between words.

💡 Support [options](#options)

```
ChangeCase::snake('test string');
// 'test_string'

ChangeCase::snake('Foo123Bar');
// 'foo123_bar'
ChangeCase::snake('Foo123Bar', ['separateNum' => true]);
// 'foo_123_bar'
```

#### swapCase

[](#swapcase)

> Transform a string by swapping every character from upper to lower case, or lower to upper case.

```
ChangeCase::swap('Test String');
// 'tEST sTRING'
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](/LICENSE) for more information.

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance93

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Recently: every ~112 days

Total

41

Last Release

36d ago

Major Versions

v3.6.6 → v4.0.02023-04-23

v3.6.7 → v4.0.12023-11-05

v3.6.8 → v4.0.22023-12-06

v3.7.1 → v4.0.32024-03-23

v3.7.2 → v4.1.02024-03-27

PHP version history (5 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^7.3|^8.0

v2.0.2PHP ^7.2|^8.0

v3.0.0PHP ^7.4 || ^8.0

v4.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/01bfff23a3bc54204b47bee797a13a438df9156915ad177258dbd1a9f110f5b7?d=identicon)[KeiJR](/maintainers/KeiJR)

---

Top Contributors

[![realodix](https://avatars.githubusercontent.com/u/1314456?v=4)](https://github.com/realodix "realodix (305 commits)")

---

Tags

camelcasechange-caseletterspascalcasesnake-casetitlecasetypeslowercaseuppercasecamel casesnake casepascal casechange-caseconstant-case

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/realodix-change-case/health.svg)

```
[![Health](https://phpackages.com/badges/realodix-change-case/health.svg)](https://phpackages.com/packages/realodix-change-case)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[doctrine/inflector

PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.

11.3k900.4M875](/packages/doctrine-inflector)[symfony/rate-limiter

Provides a Token Bucket implementation to rate limit input and output in your application

27054.3M289](/packages/symfony-rate-limiter)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[illuminate/collections

The Illuminate Collections package.

27078.0M1.1k](/packages/illuminate-collections)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
