Characters
DiffText::chars()Typos, digits, and single-letter fixes.
- −
- Recieve your refund within 5 buisness days.
- +
- Receive your refund within 3 business days.
Recieive your refund within 53 buisiness days.
Diff components for Vue, React, and PHP. Compare text by character, word, sentence, or line, or compare rich HTML without breaking its markup.
composer require sitefinitysteve/php-diff-text
Each mode breaks the text into different pieces before comparing. Smaller pieces catch typos. Larger pieces keep rewrites readable.
DiffText::chars()Typos, digits, and single-letter fixes.
DiffText::words()Reworded copy, where spacing doesn't matter.
DiffText::wordsWithSpace()Edits where spacing and indentation count.
DiffText::sentences()Paragraph edits, reviewed one sentence at a time.
DiffText::lines()Lists, configs, and anything written one item per line.
DiffText::html()Rich text from an editor, with the markup kept intact.
Returns are accepted within 1430 days of delivery.
For longer text, compare line by line. Unchanged stretches fold away, and edited lines show which words changed.
// composer require sitefinitysteve/php-diff-text use PhpDiffText\DiffText; echo DiffText::words($before, $after); echo DiffText::split($before, $after, ['contextLines' => 3]); echo DiffText::stats($before, $after, ['mode' => 'unified']); // then link css/style.css from the package