PHPackages                             corncodecreators/line-dumper - 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. corncodecreators/line-dumper

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

corncodecreators/line-dumper
============================

Show and compare strings - line by line.

v1.0.1(8mo ago)071MITPHPPHP &gt;=8.0

Since Aug 4Pushed 8mo agoCompare

[ Source](https://github.com/CornCodeCreators/line-dumper)[ Packagist](https://packagist.org/packages/corncodecreators/line-dumper)[ RSS](/packages/corncodecreators-line-dumper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (1)

LineDumper
==========

[](#linedumper)

> Show and compare strings - line by line.

Summary
-------

[](#summary)

This PHP class, `LineDumper`, provides a utility for comparing two strings line by line and highlights the differences between them.

- If the strings are identical, it simply returns "Strings are equal!".
- If they differ, it compares them line by line, indicating mismatches with color-coded output using ANSI escape codes.

Details
-------

[](#details)

- Namespace and Class Definition: The class is defined under the CornCodeCreators namespace.
- compareLines Method:
    - Input: It takes two strings, $expectedString and $actualString, which represent the expected output and the actual output.
    - Output: It returns a string containing either a confirmation that the strings are equal or a line-by-line comparison highlighting differences.
    - String Splitting: The strings are split into arrays of lines using explode("\\n", $string).
    - Line Number Width: The line numbers are padded to a width of 3 characters.
    - Comparison: Each line from the expected string is compared to the corresponding line in the actual string:
        - If the lines match, it outputs them with a simple "ok" status.
        - If they don't match, it outputs the expected line in yellow (to-be) and the actual line in red (as-is).

Example
-------

[](#example)

**Input**

```
$expected = "This is a line.\nAnother line.";
$actual   = "This is a line.\nAnother different line.";

$comparedLines = LineDumper::compareLines($expected, $actual);

echo($comparedLines);
```

**Output**

```
Line   1|   ok| This is a line.
Line   2|to-be| Another line.
Line   2|as-is| Another different line.
```

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

[](#installation)

```
$ composer require corncodecreators/line-dumper
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance58

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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 ~386 days

Total

2

Last Release

265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e01bad6c4c81d29bb9909f13aeefe042a5253b5f9c3a0f1f6b1029721332b427?d=identicon)[DigitalTimK](/maintainers/DigitalTimK)

---

Top Contributors

[![DigitalTimK](https://avatars.githubusercontent.com/u/45600940?v=4)](https://github.com/DigitalTimK "DigitalTimK (7 commits)")

---

Tags

compareline-by-linestringphpstringcompare

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/corncodecreators-line-dumper/health.svg)

```
[![Health](https://phpackages.com/badges/corncodecreators-line-dumper/health.svg)](https://phpackages.com/packages/corncodecreators-line-dumper)
```

###  Alternatives

[coduo/php-to-string

Simple library that converts PHP value into strings

27112.7M10](/packages/coduo-php-to-string)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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