jfcherng/php-diff
Generate diffs between two strings in PHP with multiple renderers: unified/context text, JSON, and rich HTML (inline, side-by-side, combined). Includes configurable differ/renderer options and helper CSS for easy HTML diff styling.
Unified/SideBySide renderers for code review tools (low effort, high impact).Inline/Combined HTML diffs to user-facing dashboards (e.g., "Your changes vs. original").Adopt if:
Look elsewhere if:
imagemagick or git diff --binary."This package lets us standardize and enhance how we visualize changes across our products—whether it’s code reviews, user-generated content, or compliance logs. For example:
ROI: Low-code integration, high reusability across teams (dev, content, compliance).
"php-diff gives us:
lengthLimit).Trade-offs:
Proposal:
Unified renderer (1 sprint).SideBySide HTML diffs to the content editor (2 sprints).Json renderer to parse edits (3 sprints).Alternatives considered:
Next steps:
array_diff or git diff) for performance."How can I help you explore Laravel packages today?