FrankTiao / html-diff

Compare two html text and return a merged html text. 对比两个html文本,返回一个合并差异后的html文本

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html-diff

Compare two html text and return a merged html text.
对比两个html文本,返回一个合并差异后的html文本

预览 Preview

截图 ScreenshotScreenshot

安装 Installation

composer require franktiao/html-diff

快速开始 Quick start

use htmlDiff\HtmlDiff;

require __DIR__.'/../vendor/autoload.php';

try {
    $diff = new HtmlDiff();
    $res = $diff->diff('Some text old', 'Some text new');
} catch (\Exception $e) {
    print_r($e->getMessage()); die;
}
print_r($res);

更多使用方式请查看 example 目录
For more usage, please see example directory

更新记录 Update record

  • v1.0.0--2020-02-19
    • A 基础版本
  • v1.0.1--2020-02-20
    • F 修复了HtmlDiff对象在单例中获取到脏数据的BUG
  • v1.0.2--2020-02-20
    • F 修复了单边标签(如img)不会对比的BUG
    • A 内置了常用单边标签:imgbrhrlinkmete,不常用的单边标签可调用$htmlDiff->setUnilateralTags()自定义追加

About

Compare two html text and return a merged html text. 对比两个html文本,返回一个合并差异后的html文本

License:MIT License


Languages

Language:PHP 96.4%Language:HTML 3.3%Language:CSS 0.4%