PHPackages                             sebastiansulinski/string-converter - 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. sebastiansulinski/string-converter

ActiveLibrary

sebastiansulinski/string-converter
==================================

Convert between snake and camel case, hyphen to camel case, to constant name, ucfirst, ucwords

v3.1.0(2y ago)840.4k↓68.3%1MITPHPPHP ^8.2CI passing

Since Mar 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/sebastiansulinski/string-converter)[ Packagist](https://packagist.org/packages/sebastiansulinski/string-converter)[ RSS](/packages/sebastiansulinski-string-converter/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (8)Used By (0)

Simple string converter
=======================

[](#simple-string-converter)

This package allows converting between different string formats.

Usage examples
--------------

[](#usage-examples)

### Class-name

[](#class-name)

```
use SSD\StringConverter\Factory;

echo Factory::classNameToCamel('PhpEol');
// phpEol

echo Factory::classNameToConstant('PhpEol');
// PHP_EOL

echo Factory::classNameToHyphen('PhpEol');
// Php-Eol

echo Factory::classNameToUnderscore('PhpEol');
// Php_Eol

echo Factory::classNameToSpace('PhpEol');
// Php Eol
```

### Camel-case

[](#camel-case)

```
use SSD\StringConverter\Factory;

echo Factory::camelToClassName('phpEol');
// PhpEol

echo Factory::camelToConstant('phpEol');
// PHP_EOL

echo Factory::camelToHyphen('phpEol');
// php-Eol

echo Factory::camelToUnderscore('phpEol');
// php_Eol

echo Factory::camelToSpace('phpEol');
// php Eol
```

### Constant

[](#constant)

```
use SSD\StringConverter\Factory;

echo Factory::constantToClassName('PHP_EOL');
// PhpEol

echo Factory::constantToCamel('PHP_EOL');
// phpEol

echo Factory::constantToHyphen('PHP_EOL');
// PHP-EOL

echo Factory::constantToUnderscore('PHP_EOL');
// PHP_EOL

echo Factory::constantToSpace('PHP_EOL');
// PHP EOL
```

### Hyphen

[](#hyphen)

```
use SSD\StringConverter\Factory;

echo Factory::hyphenToClassName('php-eol');
// PhpEol

echo Factory::hyphenToCamel('php-eol');
// phpEol

echo Factory::hyphenToConstant('php-eol');
// PHP_EOL

echo Factory::hyphenToUnderscore('php-eol');
// php_eol

echo Factory::hyphenToSpace('php-eol');
// php eol
```

### Underscore

[](#underscore)

```
use SSD\StringConverter\Factory;

echo Factory::underscoreToClassName('php_eol');
// PhpEol

echo Factory::underscoreToCamel('php_eol');
// phpEol

echo Factory::underscoreToConstant('php_eol');
// PHP_EOL

echo Factory::underscoreToHyphen('php_eol');
// php-eol

echo Factory::underscoreToSpace('php_eol');
// php eol
```

### Space

[](#space)

```
use SSD\StringConverter\Factory;

echo Factory::spaceToClassName('php eol');
// PhpEol

echo Factory::spaceToCamel('php eol');
// phpEol

echo Factory::spaceToConstant('php eol');
// PHP_EOL

echo Factory::spaceToHyphen('php eol');
// php-eol

echo Factory::spaceToUnderscore('php eol');
// php_eol
```

Optional second callback argument
---------------------------------

[](#optional-second-callback-argument)

Factory methods can take an optional, second argument of `callable` type so you can additionally modify the result:

```
echo Factory::constantToSpace('PHP_EOL');
// PHP EOL

echo Factory::constantToSpace('PHP_EOL', 'strtolower');
// php eol

echo Factory::constantToSpace('PHP_EOL', function($string) {
    return str_replace(' ', '', $string);
});
// phpeol
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance59

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 80% 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 ~534 days

Recently: every ~679 days

Total

7

Last Release

832d ago

Major Versions

1.1.0 → v2.0.02016-06-29

v2.1.0 → v3.0.02021-08-05

PHP version history (4 changes)1.0.0PHP &gt;=5.4.0

v2.1.0PHP ^7.1

v3.0.0PHP ^7.4|^8.0

v3.1.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2211203?v=4)[Sebastian Sulinski](/maintainers/sebastiansulinski)[@sebastiansulinski](https://github.com/sebastiansulinski)

---

Top Contributors

[![sebastiansulinski](https://avatars.githubusercontent.com/u/2211203?v=4)](https://github.com/sebastiansulinski "sebastiansulinski (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

camelcasehyphensphpstring-converterunderscore

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sebastiansulinski-string-converter/health.svg)

```
[![Health](https://phpackages.com/badges/sebastiansulinski-string-converter/health.svg)](https://phpackages.com/packages/sebastiansulinski-string-converter)
```

PHPackages © 2026

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