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

ActiveLibrary

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

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

0.21.4(11mo ago)015MITPHPPHP ^8.1|^8.2|^8.3

Since May 28Pushed 11mo agoCompare

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

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 59% of packages

Maintenance50

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

355d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0503978603e7f72b2ca37cf37abf33368618884e39deecc597ef36497cd07f63?d=identicon)[jrube](/maintainers/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

[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k454.7k15](/packages/robsontenorio-mary)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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