Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Htmldiff Laravel Package

caxy/php-htmldiff

Compare two HTML snippets/files and generate a marked-up diff highlighting insertions, deletions, and changes. Easy Composer install, simple API (HtmlDiff->build()), configurable behavior and CSS-friendly output; includes a live demo and Symfony bundle option.

View on GitHub
Deep Wiki
Context7
v0.1.17

What's Changed

New Contributors

Full Changelog: https://github.com/caxy/php-htmldiff/compare/v0.1.16...v0.1.17

v0.1.16

What's Changed

New Contributors

Full Changelog: https://github.com/caxy/php-htmldiff/compare/v0.1.15...v0.1.16

v0.1.15

What's Changed

New Contributors

Full Changelog: https://github.com/caxy/php-htmldiff/compare/v0.1.14...v0.1.15

v0.1.14

v0.1.14 (2022-01-19)

Full Changelog

Changes:

This release mainly removed everything that is related to the concept of special-case-tags. This was adopted from the original library by rashid2538 that this fork is based on.

The feature tried to wrap the special tags in an extra <ins / del class='mod'> tag. However, this never really worked properly (the closing tag was not always added to the diff output) and usually ended up crippling the HTML.

Given the feature never really worked, and there is no clear use-case for it, I decided to remove it and fix issue 106 and issue 69 in the process where it was sometimes impossible to diff html that contained these special tags or unexpected extra tags got added to the output.

In case you really needed this feature, please open an issue explaining your use-case, in that case this decision can be revisited.

  • Deprecated all setSpecialCaseTags() config calls. There is no replacement, but the current expectation is that nobody ever used these calls anyway.
  • Fixed Issue 106 / 69 by removing special-case-tags from the codebase
  • Reduced the CRAP score of insertTag() by allot
v0.1.13

v0.1.13 (2021-09-27)

Full Changelog

Changes:

  • Add .gitattributes file to exclude demo and tests from the exported zip package to reduce package size when installed via composer (#86 - @danepowell )
v0.1.12

v0.1.12 (2021-04-05)

Full Changelog

Changes:

  • Word parser is rebuild to improve performance by 98% (according to xhprof profiler) and reducing code complexity.
  • Whitespace checking improvements in match finding algorithm to improve performance by allot, up to 50% in some of my testing
v0.1.11

v0.1.11 (2021-02-02)

Full Changelog

Important

The changes to the list diffing are substantial, and we have tested as much as possible, to make sure the output stays the same between this version and the previous version.

If there are issues cropping up with list diffing after updating to this version feel free to open an issue

Changes:

  • Fixed a bug where self-closing tags got crippled in HtmlDiff
  • Ported ListDiff from SimpleXML to DOMDocument
  • Cleanup of old list diff algorithm
  • Possibility to disable html-purifier using a config flag
  • Removed dependency php-simple-html-dom-parser
v0.1.10

v0.1.10 (2021-01-05)

Full Changelog

Important:

In order to be compatible with PHP8 we had to upgrade some vendor packages.

Since these vendor packages have dropped support for older versions of PHP we had todo the same, therefore this version is not compatible anymore with PHP versions prior to 7.3.

In case you are not able to upgrade your PHP version, please pin version v0.1.9 of php-htmldiff in your composer config.

Changes:

  • Fixed the keywords that made this version incompatible with PHP8
  • Upgraded PHPUnit dependencies with a PHP8 compatible version
v0.1.9

v0.1.9 (2019-02-20)

Full Changelog

Merged pull requests:

v0.1.8

v0.1.8 (2019-01-15)

Full Changelog

Implemented enhancements:

  • Resolve PHP 7.3 compatibility issue to fix #79 #80 (irkallacz)

Closed issues:

  • Does not work on PHP 7.3 #79
v0.1.7

Bugfixes:

  • Fix issues with unicode characters (@iluuu1994 #71, #72)
v0.1.6
v0.1.5

Release Notes

[Bug] HTMLPurifier Permission Fix (#63) (@snebes)

v0.1.4

[BUG] changes the [] arrays to array() as it does not work in php 5.3 (@myfriend12)

v0.1.3

Full Changelog

Bug fixes

  • Fixed a crash when comparing two table columns against each other that contained a regular space character.

Features and Enhancements:

  • Improved performance in HtmlDiffer by using internal caching and more performant internal method calls. (Resolves #38)
  • Added performance test (--group performance) to measure improvements.

Thank you @SavageTiger again for the drastic performance improvements and the Release Notes!

v0.1.2

Full Changelog

Bug fixes

  • Added prepare step to the build() method to prevent HTMLPurifier config object from existing in different states. (Resolves #51)

Features and Enhancements:

  • Added test to for setPurifierCacheLocation()

Thank you @SavageTiger for your bugfix contribution, and for the Release Notes!

v0.1.1

Full Changelog

Features and Enhancements:

Miscellaneous:

  • Update the README and add additional documentation #34 (jschroed91)
0.1.0

Full Changelog

Features and Enhancements:

  • Allow caching of the calculated diffs using a doctrine cache provider #33 (jschroed91)
  • Create configuration class for HtmlDiff config options #32 (jschroed91)
  • New Feature: Table Diffing #31 (jschroed91)
  • Detect link changes to resolve #28 #30 (jschroed91)
  • Setup PHPUnit testsuite with basic functional test and a few test cases #26 (jschroed91)
0.1.0-beta.1

New Feature: Table Diffing Enhancement: Detecting link changes

0.0.14
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6

Note: There are many changes to the HtmlDiff class in this release. A new AbstractDiff class was created and HtmlDiff extends this new class, and many of the common functions have been moved into the AbstractClass in preparation for some upcoming features and enhancements for the diffing of lists and tables.

Isolated Diffing of Special HTML Tags

Purpose

The purpose of these changes is to isolate certain HTML elements in the old and new texts and diff them against the matching element (if one exists), in order to prevent issues with matches in old and new text overlapping certain HTML elements.

The Problem

As an example, let's say you have the following inputs:

Old Text

Testing text with <sup>superscript</sup>

New Text

Testing text with superscript

Output Before These Changes

Testing some text with <ins class="mod">superscript</ins>

Output After These Changes

Testing some text with <sup class="diffmod"><del class="diffmod">superscript</del></sup><ins class="diffmod">superscript</ins>

As you can see in this example, before these changes were made it was seeing the match on the word superscript in both, but was not accounting for the fact that the word was in superscript in the old text and is no longer in superscript in the new text.

Solution

The solution that was implemented in this release was to encapsulate certain HTML elements and diff them separately from the rest of the text, in order to prevent issues with matches overlapping HTML elements.

Currently, the elements to isolate and diff are: ol, ul, dl, sup, sub, and table.

These are set on a protected property on the HtmlDiff class: $isolatedDiffTags. In this release, this property is not exposed to be configured, but there are additional updates coming soon that will allow configuration of the elements to be handled in this manner.

0.0.5

Properties and functions in HtmlDiff.php have been updated to protected visibility instead of private to allow for extending the class.

0.0.4

Check for empty oldText or newText before processing del or ins in processReplaceOperation

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle