PHPackages                             juanrube/textdiff - 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. juanrube/textdiff

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

juanrube/textdiff
=================

Laravel package for text diff highlighting using jfcherng/php-diff

0.21.4(1y ago)016MITPHPPHP ^8.1|^8.2|^8.3

Since May 28Pushed 1y agoCompare

[ Source](https://github.com/juanrube/laravel-text-diff)[ Packagist](https://packagist.org/packages/juanrube/textdiff)[ RSS](/packages/juanrube-textdiff/feed)WikiDiscussions main Synced today

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

📘 Laravel Text Diff 📘
=====================

[](#-laravel-text-diff-)

Una librería Laravel para comparar textos y mostrar diferencias visuales en HTML, basada en [jfcherng/php-diff](https://github.com/jfcherng/php-diff).

---

Instalación
-----------

[](#instalación)

Requiere PHP 8.1+ y Laravel 10+.

Instalar con Composer:

```
composer require juanrube/textdiff
```

Para Laravel menor a 9 utilizar la versión especifica

```
composer require juanrube/textdiff:"1.x-dev"
```

Publicar los recursos (configuración, CSS, vistas):

```
php artisan vendor:publish --tag=text-diff
```

Esto publica:

- config/textdiff.php (archivo de configuración)
- public/vendor/textdiff/textdiff.css (estilos CSS)
- resources/views/vendor/textdiff/components/diff.blade.php (vistas)

Configuración (opcional)

```
return [
    // renderer class name:
    'rendererName' => [
        'Combined',
        'Context',
        'Inline',
        'JsonHtml',
        'JsonText',
        'SideBySide',
        'Unified',
    ],

    // the Diff class options
    'differOptions' => [
        // show how many neighbor lines
        // Differ::CONTEXT_ALL can be used to show the whole file
        'context' => 3,
        // ignore case difference
        'ignoreCase' => false,
        // ignore line ending difference
        'ignoreLineEnding' => false,
        // ignore whitespace difference
        'ignoreWhitespace' => false,
        //
        //
    ],
];
```

Carga automática de estilos CSS El paquete inyecta automáticamente los estilos necesarios mediante un View Composer global. Solo usa {!! $textdiff !!} en cualquier plantilla Blade:

```
>

    Diff Example
    {!! $textdiff !!}

    Mi título personalizado

```

Uso del Componente Blade

```

    Mi título personalizado

```

- old-text: Texto original.
- new-text: Texto modificado.

Uso del Facade

```
use Juanrube\TextDiff\Facades\TextDiff;

// Generar diff HTML
$html = TextDiff::generateDiff($oldText, $newText);

// Obtener el tag de estilos
$cssLink = TextDiff::styleTag();
```

Ejemplos renderizado

```
Hola mundo!
Esta es una prueba editada
Otra línea nueva
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance47

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

6

Last Release

401d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/67522192?v=4)[jrube](/maintainers/jrube)[@jrube](https://github.com/jrube)

---

Top Contributors

[![juanrube](https://avatars.githubusercontent.com/u/186569526?v=4)](https://github.com/juanrube "juanrube (15 commits)")

### Embed Badge

![Health badge](/badges/juanrube-textdiff/health.svg)

```
[![Health](https://phpackages.com/badges/juanrube-textdiff/health.svg)](https://phpackages.com/packages/juanrube-textdiff)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M281](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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