diff is a standalone PHP library for computing and rendering textual differences, widely used to display “expected vs actual” output in testing tools. It supports line-based and character/word-granular comparisons so you can get both coarse and fine-grained views of changes. Output builders can produce formats like unified or context diffs, or more human-friendly renderings suitable for terminals and HTML reports. Internally, the library splits input into hunks and manages edge cases such as whitespace-only changes and end-of-line variations. Its abstractions make it straightforward to plug custom output styles or colorizers without reimplementing diff logic. Because it’s the diff engine under PHPUnit, it has been exercised across countless projects and edge cases.

Features

  • Compute line-level and granular word or character diffs
  • Unified and context diff renderers with configurable output builders
  • Hunk management that groups related edits for easier reading
  • Sensible handling of whitespace and newline edge cases
  • Extensible architecture for custom colorization and HTML renderers
  • Proven reliability through long-term use in PHPUnit and other tools

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

BSD License

Follow sebastian/diff

sebastian/diff Web Site

Other Useful Business Software
Inventory and Order Management Software for Multichannel Sellers Icon
Inventory and Order Management Software for Multichannel Sellers

Avoid stockouts, overselling, and losing control as your business grows.

We are the most powerful inventory and order management platform for Amazon, Walmart, and multichannel product sellers. Centralize orders, product information, and fulfillment operations to run more efficiently, sell more products, and stay compliant with marketplace requirements so you can grow profitably.
Learn More
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of sebastian/diff!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Libraries

Registered

2025-10-22