PHPackages                             kirschbaum-development/filament-diffs - 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. kirschbaum-development/filament-diffs

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

kirschbaum-development/filament-diffs
=====================================

A Filament plugin that wraps @pierre/diffs to render beautiful file diffs and syntax-highlighted code views.

1.0.0(1mo ago)10859↑14.1%2MITPHPPHP ^8.1CI passing

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/kirschbaum-development/filament-diffs)[ Packagist](https://packagist.org/packages/kirschbaum-development/filament-diffs)[ Docs](https://github.com/kirschbaum-development/filament-diffs)[ GitHub Sponsors](https://github.com/travisobregon)[ RSS](/packages/kirschbaum-development-filament-diffs/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

[![Filament Diffs](art/logo.png)](art/logo.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/78e8f405d210e25cb7d1b53df068c704a5b933a660ddec938a78167dc21b3b98/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b69727363686261756d2d646576656c6f706d656e742f66696c616d656e742d64696666732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kirschbaum-development/filament-diffs)[![GitHub Tests Action Status](https://camo.githubusercontent.com/dabd12cb85d971e35ddd63102e9fa93aaf9aaf270f25ece64e5d5734ebe7229b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b69727363686261756d2d646576656c6f706d656e742f66696c616d656e742d64696666732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/kirschbaum-development/filament-diffs/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/0680a3267161593deb08ef28f6b2d179058ea862ee568986dffbc840d8477bd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b69727363686261756d2d646576656c6f706d656e742f66696c616d656e742d64696666732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kirschbaum-development/filament-diffs)

Syntax-highlighted file viewing and visual diff rendering for [Filament](https://filamentphp.com) infolists. Powered by [@pierre/diffs](https://diffs.com).

Components
----------

[](#components)

### FileEntry

[](#fileentry)

Renders any text-based content with syntax highlighting. Useful for displaying raw file contents, stored code, API payloads, or any structured text directly in an infolist.

   ![FileEntry component](art/file-entry-light.png)### FileDiffEntry

[](#filediffentry)

Renders a side-by-side diff between two versions of content with syntax highlighting. Useful for comparing model versions, reviewing changes, or showing before/after states.

   ![FileDiffEntry component](art/file-diff-entry-light.png)Requirements
------------

[](#requirements)

- PHP 8.1+
- Filament 3.x, 4.x, or 5.x

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

[](#installation)

```
composer require kirschbaum-development/filament-diffs -W
```

Then register the plugin in your panel provider:

```
use Kirschbaum\FilamentDiffs\FilamentDiffsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentDiffsPlugin::make(),
        ]);
}
```

Usage
-----

[](#usage)

### FileEntry

[](#fileentry-1)

Use `FileEntry` in any [infolist](https://filamentphp.com/docs/5.x/infolists/overview) to render a field's value with syntax highlighting. The state is resolved from the record attribute matching the entry name:

```
use Kirschbaum\FilamentDiffs\Infolists\Components\FileEntry;

FileEntry::make('webhook_payload')
    ->label('Webhook Payload')
    ->fileName('payload.json')
```

You can override the state entirely using a closure:

```
FileEntry::make('webhook_payload')
    ->label('Webhook Payload')
    ->fileName('payload.json')
    ->state(fn ($record) => $record->getRawPayload())
```

### FileDiffEntry

[](#filediffentry-1)

Use `FileDiffEntry` to render a side-by-side diff between two strings. Both `->old()` and `->new()` accept a string or a closure that receives the current record. A `null` value is treated as an empty string, making it easy to represent newly created files.

```
use Kirschbaum\FilamentDiffs\Infolists\Components\FileDiffEntry;

FileDiffEntry::make('content')
    ->label('Changes')
    ->fileName('post.md')
    ->old(fn ($record) => $record->previousVersion?->content)
    ->new(fn ($record) => $record->content)
```

### Setting the Language

[](#setting-the-language)

Both components detect the syntax highlighting language from the file name. You can also set it explicitly using any [Shiki language identifier](https://shiki.style/languages) — this takes precedence over file name detection:

```
FileEntry::make('source')
    ->language('php')

FileDiffEntry::make('content')
    ->old(fn ($record) => $record->previousVersion?->content)
    ->new(fn ($record) => $record->content)
    ->language('markdown')
```

### Passing Options

[](#passing-options)

Both components accept an `->options()` array that is passed directly to the underlying [@pierre/diffs](https://diffs.com/docs) components, giving you access to the full range of configuration including themes, diff styles, and more:

```
FileEntry::make('source')
    ->fileName('app.php')
    ->options([
        'theme' => 'github-dark',
    ])

FileDiffEntry::make('content')
    ->old(fn ($record) => $record->previousVersion?->content)
    ->new(fn ($record) => $record->content)
    ->fileName('post.md')
    ->options([
        'diffStyle' => 'unified',
    ])
```

See the [@pierre/diffs documentation](https://diffs.com/docs) for all available options.

Configuration
-------------

[](#configuration)

### Default Theme

[](#default-theme)

Publish the config file to set a default theme across all components in your application:

```
php artisan vendor:publish --tag="filament-diffs-config"
```

```
// config/filament-diffs.php
return [
    'default_theme' => null,
];
```

You can also set a default theme per panel via the plugin, which takes precedence over the config file:

```
FilamentDiffsPlugin::make()
    ->defaultTheme('github-dark')
```

### Theme Precedence

[](#theme-precedence)

Themes are resolved in the following order (highest priority first):

1. Per-component `->options(['theme' => '...'])`
2. Panel plugin `FilamentDiffsPlugin::make()->defaultTheme('...')`
3. Config file `filament-diffs.default_theme`

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Travis Obregon](https://github.com/travisobregon)
- [Kirschbaum Development Group](https://kirschbaumdevelopment.com)
- [@pierre/diffs](https://diffs.com) by [The Pierre Computer Co.](https://github.com/pierrecomputer)
- [All Contributors](../../contributors)

Sponsorship
-----------

[](#sponsorship)

Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com?utm_source=github) or [join us](https://careers.kirschbaumdevelopment.com?utm_source=github)!

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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

Unknown

Total

1

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57e405b52d482c9de35b17f299d2745e8e68d9d9951aec64854f2d7fa53110bf?d=identicon)[luisdalmolin](/maintainers/luisdalmolin)

![](https://www.gravatar.com/avatar/26b7c6714da7dc93a8e175826dc8d80f422ee3b4d7500f361c9b7e92ce24b83d?d=identicon)[travisobregon](/maintainers/travisobregon)

---

Top Contributors

[![travisobregon](https://avatars.githubusercontent.com/u/12074713?v=4)](https://github.com/travisobregon "travisobregon (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelfilamentfilament-pluginfilamentphpkirschbaum-developmentfilament-diffs

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kirschbaum-development-filament-diffs/health.svg)

```
[![Health](https://phpackages.com/badges/kirschbaum-development-filament-diffs/health.svg)](https://phpackages.com/packages/kirschbaum-development-filament-diffs)
```

###  Alternatives

[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

127173.7k3](/packages/dotswan-filament-map-picker)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12351.0k](/packages/jibaymcs-filament-tour)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[wsmallnews/filament-nestedset

Filament nestedset tree builder powered by kalnoy/nestedset with Filament v4 and v5 support

196.5k14](/packages/wsmallnews-filament-nestedset)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6643.3k](/packages/marcelweidum-filament-passkeys)[guava/filament-modal-relation-managers

Allows you to embed relation managers inside filament modals.

7976.7k4](/packages/guava-filament-modal-relation-managers)

PHPackages © 2026

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