sebastian/diff
Diff implementation
9.0.0
975M downloads/mo
#41 most downloaded on composer
sebastianbergmann/diff
What this package is like to depend on
Last release 2 months ago
05 Jun 2026
Release timing varies
gaps range from 3 weeks to 12 months
Most releases are documented
notes for 25 of 39 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
39 releases · first in 2013
6 releases in the last 12 months
see the full history below
Release timeline
39 releases · Jul 2013 to Jun 2026Releases
latest 39-
9.0.005 Jun 2026Release notes
Open source →Changed
- #138: Use Eugene W. Myers' linear-space algorithm
Removed
- #157: The
UnifiedDiffOutputBuilderandAbstractChunkOutputBuilderclasses have been removed, useStrictUnifiedDiffOutputBuilderinstead - The
SebastianBergmann\Diff\LongestCommonSubsequenceCalculatorinterface, its two implementationsSebastianBergmann\Diff\TimeEfficientLongestCommonSubsequenceCalculatorandSebastianBergmann\Diff\MemoryEfficientLongestCommonSubsequenceCalculator, and the$lcsparameter ofSebastianBergmann\Diff\Differ::diff()andSebastianBergmann\Diff\Differ::diffToArray()have been removed
Release notes
Open source →Changed
- #138: Use Eugene W. Myers' linear-space algorithm
Removed
- #157: The
UnifiedDiffOutputBuilderandAbstractChunkOutputBuilderclasses have been removed, useStrictUnifiedDiffOutputBuilderinstead - The
SebastianBergmann\Diff\LongestCommonSubsequenceCalculatorinterface, its two implementationsSebastianBergmann\Diff\TimeEfficientLongestCommonSubsequenceCalculatorandSebastianBergmann\Diff\MemoryEfficientLongestCommonSubsequenceCalculator, and the$lcsparameter ofSebastianBergmann\Diff\Differ::diff()andSebastianBergmann\Diff\Differ::diffToArray()have been removed
-
8.3.015 May 2026Release notes
Open source →Added
- #136:
UnifiedDiffOutputBuildernow accepts a fourth$emitNoLineEndEofWarningconstructor parameter (defaulttrue) to suppress the\ No newline at end of filemarker for use cases such as PHPUnit comparison failures that are not related to files - #136:
StrictUnifiedDiffOutputBuildernow accepts the optionsaddLineNumbers,emitDiffLineEndWarning,emitNoLineEndEofWarning, andheader
Changed
- #136:
UnifiedDiffOutputBuildernow returns an empty string when no difference is detected (previously: returned the header) - #136:
UnifiedDiffOutputBuilder::writeHunk()now writes the actual\ No newline at end of filemarker text (previously: wrote only a line break) and silently skips diff entries with unknown types
Deprecated
- The
SebastianBergmann\Diff\LongestCommonSubsequenceCalculatorinterface, its two implementationsSebastianBergmann\Diff\TimeEfficientLongestCommonSubsequenceCalculatorandSebastianBergmann\Diff\MemoryEfficientLongestCommonSubsequenceCalculator, and the$lcsparameter ofSebastianBergmann\Diff\Differ::diff()andSebastianBergmann\Diff\Differ::diffToArray()are now deprecated; do not pass the$lcsparameter any more in preparation for the removal of these symbols and this parameter, respectively
Release notes
Open source →Added
- #136:
UnifiedDiffOutputBuildernow accepts a fourth$emitNoLineEndEofWarningconstructor parameter (defaulttrue) to suppress the\ No newline at end of filemarker for use cases such as PHPUnit comparison failures that are not related to files - #136:
StrictUnifiedDiffOutputBuildernow accepts the optionsaddLineNumbers,emitDiffLineEndWarning,emitNoLineEndEofWarning, andheader
Changed
- #136:
UnifiedDiffOutputBuildernow returns an empty string when no difference is detected (previously: returned the header) - #136:
UnifiedDiffOutputBuilder::writeHunk()now writes the actual\ No newline at end of filemarker text (previously: wrote only a line break) and silently skips diff entries with unknown types
Deprecated
- The
SebastianBergmann\Diff\LongestCommonSubsequenceCalculatorinterface, its two implementationsSebastianBergmann\Diff\TimeEfficientLongestCommonSubsequenceCalculatorandSebastianBergmann\Diff\MemoryEfficientLongestCommonSubsequenceCalculator, and the$lcsparameter ofSebastianBergmann\Diff\Differ::diff()andSebastianBergmann\Diff\Differ::diffToArray()are now deprecated; do not pass the$lcsparameter any more in preparation for the removal of these symbols and this parameter, respectively
- #136:
-
8.2.114 May 2026 -
8.2.014 May 2026Release notes
Open source →Changed
- #136: Align
UnifiedDiffOutputBuilderbehavior withStrictUnifiedDiffOutputBuilder
Release notes
Open source →Changed
- #136: Align
UnifiedDiffOutputBuilderbehavior withStrictUnifiedDiffOutputBuilder
- #136: Align
-
8.1.005 Apr 2026Release notes
Open source →Added
- #135: Add
$contextLinesconstructor parameter onUnifiedDiffOutputBuilder
Release notes
Open source →Added
- #135: Add
$contextLinesconstructor parameter onUnifiedDiffOutputBuilder
- #135: Add
-
8.0.006 Feb 2026 -
7.0.007 Feb 2025 -
6.0.203 Jul 2024Release notes
Open source →Changed
- This project now uses PHPStan instead of Psalm for static analysis
Release notes
Open source →Changed
- This project now uses PHPStan instead of Psalm for static analysis
-
6.0.102 Mar 2024 -
6.0.002 Feb 2024Release notes
Open source →Removed
SebastianBergmann\Diff\Chunk::getStart(),SebastianBergmann\Diff\Chunk::getStartRange(),SebastianBergmann\Diff\Chunk::getEnd(),SebastianBergmann\Diff\Chunk::getEndRange(), andSebastianBergmann\Diff\Chunk::getLines()SebastianBergmann\Diff\Diff::getFrom(),SebastianBergmann\Diff\Diff::getTo(), andSebastianBergmann\Diff\Diff::getChunks()SebastianBergmann\Diff\Line::getContent()andSebastianBergmann\Diff\Diff::getType()- This component is no longer supported on PHP 8.1
-
5.1.102 Mar 2024 -
5.1.022 Dec 2023Release notes
Open source →Added
SebastianBergmann\Diff\Chunk::start(),SebastianBergmann\Diff\Chunk::startRange(),SebastianBergmann\Diff\Chunk::end(),SebastianBergmann\Diff\Chunk::endRange(), andSebastianBergmann\Diff\Chunk::lines()SebastianBergmann\Diff\Diff::from(),SebastianBergmann\Diff\Diff::to(), andSebastianBergmann\Diff\Diff::chunks()SebastianBergmann\Diff\Line::content()andSebastianBergmann\Diff\Diff::type()SebastianBergmann\Diff\Line::isAdded(),SebastianBergmann\Diff\Line::isRemoved(), andSebastianBergmann\Diff\Line::isUnchanged()
Changed
SebastianBergmann\Diff\Diffnow implementsIteratorAggregate, iterating over it yields the aggregatedSebastianBergmann\Diff\ChunkobjectsSebastianBergmann\Diff\Chunknow implementsIteratorAggregate, iterating over it yields the aggregatedSebastianBergmann\Diff\Lineobjects
Deprecated
SebastianBergmann\Diff\Chunk::getStart(),SebastianBergmann\Diff\Chunk::getStartRange(),SebastianBergmann\Diff\Chunk::getEnd(),SebastianBergmann\Diff\Chunk::getEndRange(), andSebastianBergmann\Diff\Chunk::getLines()SebastianBergmann\Diff\Diff::getFrom(),SebastianBergmann\Diff\Diff::getTo(), andSebastianBergmann\Diff\Diff::getChunks()SebastianBergmann\Diff\Line::getContent()andSebastianBergmann\Diff\Diff::getType()
-
5.0.301 May 2023Release notes
Open source →Changed
- #119: Improve performance of
TimeEfficientLongestCommonSubsequenceCalculator
- #119: Improve performance of
-
5.0.201 May 2023Release notes
Open source →Changed
- #118: Improve performance of
MemoryEfficientLongestCommonSubsequenceCalculator
- #118: Improve performance of
-
5.0.123 Mar 2023Release notes
Open source →Fixed
- #115:
Parser::parseFileDiff()does not handle diffs correctly that only add lines or only remove lines
- #115:
-
5.0.003 Feb 2023Release notes
Open source →Changed
- Passing a
DiffOutputBuilderInterfaceinstance toDiffer::__construct()is no longer optional
Removed
- This component is no longer supported on PHP 7.3, PHP 7.4, and PHP 8.0
- Passing a
-
4.0.602 Mar 2024Nothing published for this version
-
4.0.507 May 2023Nothing published for this version
-
4.0.426 Oct 2020 -
4.0.328 Sep 2020Release notes
Open source →Changed
- Changed PHP version constraint in
composer.jsonfrom^7.3 || ^8.0to>=7.3
- Changed PHP version constraint in
-
4.0.230 Jun 2020 -
4.0.108 May 2020 -
4.0.007 Feb 2020 -
3.0.602 Mar 2024Nothing published for this version
-
3.0.501 Mar 2024Nothing published for this version
-
3.0.407 May 2023Nothing published for this version
-
3.0.330 Nov 2020Nothing published for this version
-
3.0.204 Feb 2019Release notes
Open source →Changed
Chunk::setLines()now ensures that the$linesarray only containsLineobjects
-
3.0.110 Jun 2018 -
3.0.001 Feb 2018Release notes
Open source →- The
StrictUnifiedDiffOutputBuilderimplementation of theDiffOutputBuilderInterfacewas added
Changed
- The default
DiffOutputBuilderInterfaceimplementation now generates context lines (unchanged lines)
Removed
- This component is no longer supported on PHP 7.0
Fixed
- #70: Diffing of arrays no longer works
- The
-
2.0.103 Aug 2017Release notes
Open source →Fixed
- #66: Restored backwards compatibility for PHPUnit 6.1.4, 6.2.0, 6.2.1, 6.2.2, and 6.2.3
-
1.4.322 May 2017Nothing published for this version
-
1.4.218 May 2017Nothing published for this version
-
1.4.108 Dec 2015Nothing published for this version
-
1.4.006 Dec 2015Nothing published for this version
-
1.3.022 Feb 2015Nothing published for this version
-
1.2.015 Aug 2014Nothing published for this version
-
1.1.003 Aug 2013Nothing published for this version
-
1.0.009 Jul 2013Nothing published for this version