Download the PHP package jfcherng/php-diff without Composer
On this page you can find all versions of the php package jfcherng/php-diff. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jfcherng/php-diff
More information about jfcherng/php-diff
Files in jfcherng/php-diff
Package php-diff
Short Description A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc).
License BSD-3-Clause
Rated 5.00 based on 1 reviews
Informations about the package php-diff
php-diff
A comprehensive library for generating diff between two strings.
Introduction
Generated diff can be rendered in all of the standard formats including:
Text renderers:
- Context
- Json (plain text)
- Unified
HTML renderers:
- Combined
- Inline
- Json (HTML)
- Side by Side
Note that for HTML rendered results, you have to add CSS for a better visualization.
You may modify one from example/diff-table.css or write your own from zero.
If you are okay with the default CSS, there is \Jfcherng\Diff\DiffHelper::getStyleSheet()
which can be used to get the content of the example/diff-table.css.
Requirements
Installation
This package is available on Packagist by the name of jfcherng/php-diff.
Example
See files and readme in the example/ directory.
Rendered Results
HTML Diff In-line Detailed Rendering
| None-level | Line-level (Default) |
|---|---|
![]() |
![]() |
| Word-level | Char-level |
![]() |
![]() |
Renderer: Inline

Renderer: Side By Side

Renderer: Combined
This renderer is suitable for articles and always has no line number information.

Renderer: Unified
About the Unified diff format: https://en.wikipedia.org/wiki/Diff#Unified_format
Renderer: Context
About the Context diff format: https://en.wikipedia.org/wiki/Diff#Context_format
Click to expand
Renderer: Text JSON
This renderer has no detailed diff.
Click to expand
Renderer: HTML JSON
For a "tag": "rep" (8) block, this renderer has HTML-style detailed diff.
If you don't need those detailed diff, consider using the JsonText renderer.
Click to expand
Custom Language
Override an Existing Language
If you just want to override some translations of an existing language...
Acknowledgment
This package is built on the top of chrisboulton/php-diff initially. But the original repository looks like no longer maintained. Here have been quite lots of rewrites and new features since then, hence I re-started this as a new package for better visibility.
All versions of php-diff with dependencies
jfcherng/php-color-output Version ^3
jfcherng/php-mb-string Version ^1.4.6 || ^2
jfcherng/php-sequence-matcher Version ^5



