PHPackages                             franktiao/html-diff - 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. franktiao/html-diff

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

franktiao/html-diff
===================

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

v1.0.4(6y ago)10241MITPHPPHP &gt;=7.0

Since Feb 19Pushed 6y ago2 watchersCompare

[ Source](https://github.com/FrankTiao/html-diff)[ Packagist](https://packagist.org/packages/franktiao/html-diff)[ Docs](https://github.com/FrankTiao/html-diff)[ RSS](/packages/franktiao-html-diff/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (7)Used By (0)

html-diff
---------

[](#html-diff)

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

预览 Preview
----------

[](#预览-preview)

[截图 ScreenshotScreenshot](https://raw.githubusercontent.com/FrankTiao/html-diff/master/example/Preview.png)

安装 Installation
---------------

[](#安装--installation)

```
composer require franktiao/html-diff

```

快速开始 Quick start
----------------

[](#快速开始--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
------------------

[](#更新记录-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` 内置了常用单边标签：`img`、`br`、`hr`、`link`、`mete`，不常用的单边标签可调用`$htmlDiff->setUnilateralTags()`自定义追加

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

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

Every ~26 days

Total

5

Last Release

2212d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e9a25cb427c6889cea2450a05daecb755d6793d42706f613069de0112479b06?d=identicon)[FrankTiao](/maintainers/FrankTiao)

---

Top Contributors

[![FrankDiao](https://avatars.githubusercontent.com/u/37222117?v=4)](https://github.com/FrankDiao "FrankDiao (29 commits)")[![FrankTiao](https://avatars.githubusercontent.com/u/61052574?v=4)](https://github.com/FrankTiao "FrankTiao (1 commits)")

---

Tags

html diffrich text diffhtml rich text diff

### Embed Badge

![Health badge](/badges/franktiao-html-diff/health.svg)

```
[![Health](https://phpackages.com/badges/franktiao-html-diff/health.svg)](https://phpackages.com/packages/franktiao-html-diff)
```

###  Alternatives

[cheesegrits/filament-google-maps

A Google Maps package for Filament PHP with field, column and widget

324613.0k2](/packages/cheesegrits-filament-google-maps)[icap/html-diff

A PHP5 library that diffs (compares) HTML files.

29119.5k4](/packages/icap-html-diff)[components/highlightjs

Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages.

102210.6k10](/packages/components-highlightjs)[smuuf/primi

A scripting language written in PHP &amp; executable within PHP.

13277.7k](/packages/smuuf-primi)[treeware/plant

13358.6k7](/packages/treeware-plant)[helis/settings-manager-bundle

Provides a nice way to define variables and inject them into application parts

2971.4k](/packages/helis-settings-manager-bundle)

PHPackages © 2026

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