PHPackages                             rasmusrosengren/string-diff - 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. rasmusrosengren/string-diff

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

rasmusrosengren/string-diff
===========================

A class to extract variables in identically formatted string with only small differences

1.0.0(9y ago)16MITPHPPHP 5.6.\*

Since Aug 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/rasmusrosengren/string-diff)[ Packagist](https://packagist.org/packages/rasmusrosengren/string-diff)[ RSS](/packages/rasmusrosengren-string-diff/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

StringDiff
==========

[](#stringdiff)

StringDiff is a small plugin that allows easy manipulation of similarly formatted strings, with very small differences at same places.

Usage
-----

[](#usage)

```
new StringDiff
$stringd = new StringDiff;

$test_array = [
    "Your Cooldown Reduction cap is increased to 41% and you gain 1% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 42% and you gain 2% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 43% and you gain 3% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 44% and you gain 4% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 45% and you gain 5% Cooldown Reduction",
];

$stringd->run($test_array);
foreach($stringd->getArgs() as $arg)
{
    echo vsprintf($stringd->getUnformattedString(), $arg) . '';
}

```

The `run(array $arr)` method processes the array of data and outputs the unformatted string and an array of arguments, the unformatted string contains `%s` which in turns are replaces by the arguments using `vsprintf($unformatted string, array $args)` after manipulation.

The `getUnformattedString()` method returns the unformatted string which contains the `%s` placeholders.

The `getArgs()` returns an array of arguments formatted as following:

```
0 => [
    0 => 41
    1 => 1
],
1 => [
  0 => 42,
  1 => 2
]
...

```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3613d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c5b3ae2b47434ce8b0d9f7bd183ed898817dea065e84c38a87bc810910d322c?d=identicon)[feareoc](/maintainers/feareoc)

### Embed Badge

![Health badge](/badges/rasmusrosengren-string-diff/health.svg)

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

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k193.1M3.0k](/packages/composer-composer)[composer/metadata-minifier

Small utility library that handles metadata minification and expansion.

181120.4M21](/packages/composer-metadata-minifier)[php-cuong/magento2-regions-manager

Manage regions in magento2 addresses

3620.2k](/packages/php-cuong-magento2-regions-manager)

PHPackages © 2026

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