mistralys/text-diff
A PHP library for comparing text and rendering differences. It computes diffs between strings or files and presents changes in HTML or plain text via a flexible API, making it easy to add clear diff views to PHP applications.
Architecture fit
Integration feasibility
composer require, namespace-based registration, no service provider needed unless we wrapper it. Expect < 1 day for a spike, 3–5 days for a production-quality wrapper (sanitization, caching, DTOs, tests).DiffService bound in the container, a DiffResult value object, renderer selection via a config/enum, output cached by content hash.Technical risk
unknown. Before adoption, confirm upstream home, issue tracker, and that the Packagist vendor matches the source repo. MIT licensing is permissive and compatible, but we need a verified, pinnable source.Key questions
sebastian/diff + our own renderer an acceptable substitute, and what would that cost?Stack fit
inline, side_by_side, text) and a DiffPresenter that owns escaping and view data.Migration path
diff computed client-side) → introduce the service, dual-run for one release behind a feature flag, compare rendered output for parity, then retire the old path.diff/git diff or uses a heavier dependency, this is a simplification — but confirm output equivalence expectations with stakeholders first, since line-number and whitespace semantics differ between engines.Compatibility
Sequencing
DiffService + DiffResult DTO + renderer enum + config-driven limits, with unit tests independent of the library's internals.hash(old) + hash(new) + mode, then roll out to remaining surfaces.Maintenance
composer update byproducts.Support
Scaling
Failure modes
Ramp-up
How can I help you explore Laravel packages today?