Alto Code Diff compares text, renders structured differences, and parses, emits, or applies unified patches. It works with strings and in-memory path maps, so applications retain control of file and process access.
use Alto\Code\Diff\Diff;
use Alto\Code\Diff\Renderer\UnifiedRenderer;
$result = Diff::build()->compare("old\n", "new\n");
$output = (new UnifiedRenderer('old.txt', 'new.txt'))->render($result);- Installation: install the package and verify its requirements.
- Getting started: compare two strings and render a unified diff.
- Diffing: configure comparisons, inspect results, and select an engine.
- Rendering: produce unified text, HTML, JSON, or ANSI output.
- Formats: emit, parse, and apply single-file or multi-file patches.
- Errors: recover from rejected inputs and patches.
The package rejects binary input. It does not read or write files, invoke Git, or resolve patch conflicts automatically.