Skip to content

A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc). Based on the difflib implementation in Python

License

Notifications You must be signed in to change notification settings

JBlond/php-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Diff Class

SensioLabsInsight Codacy Badge

Latest Version

Introduction

A comprehensive library for generating differences between two hashable objects (strings or arrays). Generated differences can be rendered in all of the standard formats including:

  • Unified
  • Context
  • Inline HTML
  • Side by Side HTML

The logic behind the core of the diff engine (ie, the sequence matcher) is primarily based on the Python difflib package. The reason for doing so is primarily because of its high degree of accuracy.

Example Use

A quick usage example can be found in the example/ directory and under example.php.

Example Image

Example 2 Image

Requirements

  • PHP 7.1 or greater
  • PHP Multibyte String

Merge files using jQuery

Xiphe has build a jQuery plugin with that you can merge the compared files. Have a look at jQuery-Merge-for-php-diff.

Todo

  • Ability to ignore blank line changes
  • 3 way diff support
  • Performance optimizations

Contributors

Contributors since I forked the repo.

  • maxxer
  • Creris
  • jfcherng

License (BSD License)

see License

About

A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc). Based on the difflib implementation in Python

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • PHP 95.4%
  • CSS 4.6%