fuyuan9 / diff-view
A Filament plugin for viewing diffs.
Fund package maintenance!
fuyuan9
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/fuyuan9/diff-view
Requires
- php: ^8.3
- filament/filament: ^4.0|^5.0
- sebastian/diff: ^6.0|^7.0
- spatie/laravel-package-tools: ^1.15
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0|^10.0
This package is auto-updated.
Last update: 2026-01-29 11:22:31 UTC
README
A Filament plugin for viewing diffs between text or unified diff strings, powered by diff2html.
Installation
You can install the package via composer:
composer require fuyuan9/diff-view
Usage
DiffEntry::make('diff') ->old($record->old_content) ->new($record->new_content),
Or provide a pre-generated unified diff:
DiffEntry::make('diff') ->diff($record->unified_diff),
Infolists
You can use the DiffEntry in your Filament Infolists:
use Fuyuan9\DiffView\Infolists\Components\DiffEntry; public static function configure(Schema $schema): Schema { return $schema ->components([ DiffEntry::make('diff') ->diff(<<<DIFF diff --git a/sample.js b/sample.js index 0000001..0ddf2ba --- a/sample.js +++ b/sample.js @@ -1 +1 @@ -console.log("Hello World!") +console.log("Hello from Diff2Html!")` DIFF), ]); }
Customization
You can customize the diff2html display options:
DiffEntry::make('diff') ->old($old) ->new($new) ->outputFormat('line-by-line') // 'side-by-side' (default) or 'line-by-line' ->matching('none') // 'lines' (default), 'words' or 'none' ->drawFileList(true); // false (default) or true
Development
This project uses Docker for the development environment. You can run the following commands to maintain code quality:
Run Tests
docker exec filament-app vendor/bin/phpunit
Static Analysis
docker exec filament-app vendor/bin/phpstan analyze
Format Code
docker exec filament-app vendor/bin/pint
Build Assets
docker exec filament-app npm run build
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
