spatie/phpunit-snapshot-assertions
Snapshot testing with PHPUnit
5.4.0
21M downloads/mo
#806 most downloaded on Packagist
spatie/phpunit-snapshot-assertions
What this package is like to depend on
Last release 3 months ago
29 Apr 2026
Release timing varies
gaps range from 2 weeks to 7 months
Most releases are documented
notes for 61 of 72 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
72 releases · first in 2016
5 releases in the last 12 months
see the full history below
Release timeline
72 releases · Dec 2016 to Apr 2026Releases
latest 60 of 72-
5.4.029 Apr 2026Release notes
Open source →What's Changed
- Add
vendor/bin/update-snapshotswrapper binary that setsUPDATE_SNAPSHOTS=trueand runs PHPUnit. This replaces the previously documentedphpunit -d --update-snapshotssyntax, which abused PHPUnit's-dflag and produces aFailed to set "--update-snapshots=1"test runner warning since PHPUnit 12.5.12. - Drop the
phpunit -d --without-creating-snapshotsform from the README. Use theCREATE_SNAPSHOTS=falseenvironment variable instead. The argv check is kept inshouldCreateSnapshots()for backwards compatibility. - The wrapper restores the prior
UPDATE_SNAPSHOTSenv var state on shutdown, so it does not leak a state mutation to any in-process code that runs after PHPUnit. - Reworded the "Snapshot does not exist" failure message and the "snapshots can be updated by..." prompt to point at the new approach.
shouldUpdateSnapshots()andshouldCreateSnapshots()now check the env var first, then fall back to the legacy CLI argument.- Fix tests on PHPUnit 12.5+, where mocks throwing
AssertionFailedErrorare tracked as a test failure even when user code catches the exception. TheexpectFailhelper now uses a plainRuntimeExceptioncarrying the expected message.
Closes #242.
Full Changelog: 5.3.2...5.4.0
Release notes
Open source →What's Changed
- Add
vendor/bin/update-snapshotswrapper binary that setsUPDATE_SNAPSHOTS=trueand runs PHPUnit. This replaces the previously documentedphpunit -d --update-snapshotssyntax, which abused PHPUnit's-dflag and produces aFailed to set "--update-snapshots=1"test runner warning since PHPUnit 12.5.12. - Drop the
phpunit -d --without-creating-snapshotsform from the README. Use theCREATE_SNAPSHOTS=falseenvironment variable instead. The argv check is kept inshouldCreateSnapshots()for backwards compatibility. - The wrapper restores the prior
UPDATE_SNAPSHOTSenv var state on shutdown, so it does not leak a state mutation to any in-process code that runs after PHPUnit. - Reworded the "Snapshot does not exist" failure message and the "snapshots can be updated by..." prompt to point at the new approach.
shouldUpdateSnapshots()andshouldCreateSnapshots()now check the env var first, then fall back to the legacy CLI argument.- Fix tests on PHPUnit 12.5+, where mocks throwing
AssertionFailedErrorare tracked as a test failure even when user code catches the exception. TheexpectFailhelper now uses a plainRuntimeExceptioncarrying the expected message.
Closes #242.
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.3.2...5.4.0
- Add
-
5.3.209 Feb 2026Release notes
Open source →What's Changed
- Fix BC break in
getSnapshotId()from named snapshots feature — restored original no-parameter signature - Add README documentation for named snapshots
Full Changelog: 5.3.1...5.3.2
Release notes
Open source →What's Changed
- Fix BC break in
getSnapshotId()from named snapshots feature — restored original no-parameter signature - Add README documentation for named snapshots
- Fix BC break in
-
5.3.108 Feb 2026 -
5.3.022 Jan 2026Release notes
Open source →What's Changed
- Add support for PHPUnit 9.6 by @alex-dev in #235
- Add PHPUnit versioning to CI matrix to test against multiple PHPUnit versions
- Add PhpUnitCompatibility trait for cross-version compatibility
- Fix CI workflow to properly handle PHPUnit version constraints
Full Changelog: 5.2.3...5.3.0
Release notes
Open source →What's Changed
- Add support for PHPUnit 9.6 by @alex-dev in https://github.com/spatie/phpunit-snapshot-assertions/pull/235
- Add PHPUnit versioning to CI matrix to test against multiple PHPUnit versions
- Add PhpUnitCompatibility trait for cross-version compatibility
- Fix CI workflow to properly handle PHPUnit version constraints
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.3...5.3.0
-
5.2.314 Nov 2025Release notes
Open source →What's Changed
- Update issue template by @AlexVanderbist in #222
- feat: allow symfony 8 by @Chris53897 in #228
- Bump stefanzweifel/git-auto-commit-action from 6 to 7 by @dependabot[bot] in #223
New Contributors
- @Chris53897 made their first contribution in #228
Full Changelog: 5.2.2...5.2.3
Release notes
Open source →What's Changed
- Update issue template by @AlexVanderbist in https://github.com/spatie/phpunit-snapshot-assertions/pull/222
- feat: allow symfony 8 by @Chris53897 in https://github.com/spatie/phpunit-snapshot-assertions/pull/228
- Bump stefanzweifel/git-auto-commit-action from 6 to 7 by @dependabot[bot] in https://github.com/spatie/phpunit-snapshot-assertions/pull/223
New Contributors
- @Chris53897 made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/228
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.2...5.2.3
-
5.2.219 Aug 2025Release notes
Open source →What's Changed
- Bump aglipanci/laravel-pint-action from 2.5 to 2.6 by @dependabot[bot] in #217
- Update parameter type hints in ObjectDriver constructor docblock by @tassilogroeper in #220
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #219
Full Changelog: 5.2.1...5.2.2
Release notes
Open source →What's Changed
- Bump aglipanci/laravel-pint-action from 2.5 to 2.6 by @dependabot[bot] in https://github.com/spatie/phpunit-snapshot-assertions/pull/217
- Update parameter type hints in ObjectDriver constructor docblock by @tassilogroeper in https://github.com/spatie/phpunit-snapshot-assertions/pull/220
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in https://github.com/spatie/phpunit-snapshot-assertions/pull/219
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.1...5.2.2
-
5.2.102 Jul 2025Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in #213
- Bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot in #215
- Allow
assertMatchesJsonSnapshotto accept any JSON-serializable value by @LuckyWindsck in #216
New Contributors
- @LuckyWindsck made their first contribution in #216
Full Changelog: 5.2.0...5.2.1
Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/213
- Bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/215
- Allow
assertMatchesJsonSnapshotto accept any JSON-serializable value by @LuckyWindsck in https://github.com/spatie/phpunit-snapshot-assertions/pull/216
New Contributors
- @LuckyWindsck made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/216
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.0...5.2.1
-
5.2.008 May 2025Release notes
Open source →What's Changed
- Allow setting yamlInline for ObjectDriver by @tassilogroeper in #212
New Contributors
- @tassilogroeper made their first contribution in #212
Full Changelog: 5.1.8...5.2.0
Release notes
Open source →What's Changed
- Allow setting yamlInline for ObjectDriver by @tassilogroeper in https://github.com/spatie/phpunit-snapshot-assertions/pull/212
New Contributors
- @tassilogroeper made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/212
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.8...5.2.0
-
5.1.810 Feb 2025Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in #207
- Bump aglipanci/laravel-pint-action from 2.4 to 2.5 by @dependabot in #208
- Allow phpunit 12 by @mfruehauf in #209
New Contributors
- @mfruehauf made their first contribution in #209
Full Changelog: 5.1.7...5.1.8
Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/207
- Bump aglipanci/laravel-pint-action from 2.4 to 2.5 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/208
- Allow phpunit 12 by @mfruehauf in https://github.com/spatie/phpunit-snapshot-assertions/pull/209
New Contributors
- @mfruehauf made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/209
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.7...5.1.8
-
5.1.709 Dec 2024Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in #203
- Bump oven-sh/setup-bun from 1 to 2 by @dependabot in #202
- gha: run tests against PHP 8.4 too by @erikn69 in #204
- Improve readability of generated JSON snapshots by @ostrolucky in #205
New Contributors
- @erikn69 made their first contribution in #204
- @ostrolucky made their first contribution in #205
Full Changelog: 5.1.6...5.1.7
Release notes
Open source →What's Changed
- Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/203
- Bump oven-sh/setup-bun from 1 to 2 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/202
- gha: run tests against PHP 8.4 too by @erikn69 in https://github.com/spatie/phpunit-snapshot-assertions/pull/204
- Improve readability of generated JSON snapshots by @ostrolucky in https://github.com/spatie/phpunit-snapshot-assertions/pull/205
New Contributors
- @erikn69 made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/204
- @ostrolucky made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/205
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.6...5.1.7
-
5.1.603 May 2024Release notes
Open source →What's Changed
- Minor updates and improvements by @patinthehat in https://github.com/spatie/phpunit-snapshot-assertions/pull/192
- Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/194
- Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/200
- chmod snapshot folders and files by @Niolak in https://github.com/spatie/phpunit-snapshot-assertions/pull/199
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.5...5.1.6
-
5.1.520 Feb 2024Release notes
Open source →What's Changed
- gha: run tests against PHP 8.3 too by @mfn in https://github.com/spatie/phpunit-snapshot-assertions/pull/188
- Use PHPUnit attributes by @simonhammes in https://github.com/spatie/phpunit-snapshot-assertions/pull/187
New Contributors
- @simonhammes made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/187
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.4...5.1.5
-
5.1.403 Feb 2024Release notes
Open source →What's Changed
- Bump aglipanci/laravel-pint-action from 2.3.0 to 2.3.1 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/183
- Allow phpunit 11 by @mfn in https://github.com/spatie/phpunit-snapshot-assertions/pull/185
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.3...5.1.4
-
5.1.329 Nov 2023Release notes
Open source →What's Changed
- Bump actions/setup-node from 3 to 4 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/181
- Symfony 7.0 by @janatjak in https://github.com/spatie/phpunit-snapshot-assertions/pull/182
New Contributors
- @janatjak made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/182
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.2...5.1.3
-
5.1.211 Oct 2023Release notes
Open source →What's Changed
- Bump actions/setup-node from 2 to 3 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/176
- fix: correct typo in readme by @TSchuermans in https://github.com/spatie/phpunit-snapshot-assertions/pull/178
- Fix #179 - assert difference between empty array and object. by @Sam152 in https://github.com/spatie/phpunit-snapshot-assertions/pull/180
- Bump stefanzweifel/git-auto-commit-action from 4 to 5 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/177
New Contributors
- @TSchuermans made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/178
- @Sam152 made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/180
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.1...5.1.2
-
5.1.112 Sep 2023 -
5.1.011 Sep 2023Release notes
Open source →What's Changed
- Add image assertions by @freekmurze in https://github.com/spatie/phpunit-snapshot-assertions/pull/175
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.0.2...5.1.0
-
5.0.220 Apr 2023Nothing published for this version
-
5.0.113 Feb 2023Release notes
Open source →What's Changed
- Generate snapshot file names with dataset by @pierres in https://github.com/spatie/phpunit-snapshot-assertions/pull/163
- Bump aglipanci/laravel-pint-action from 0.1.0 to 2.1.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/164
- Update windows users info in readme.md by @raveren in https://github.com/spatie/phpunit-snapshot-assertions/pull/150
New Contributors
- @pierres made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/163
- @raveren made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/150
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.0.0...5.0.1
-
5.0.009 Feb 2023Release notes
Open source →What's Changed
- Add Dependabot Automation by @patinthehat in https://github.com/spatie/phpunit-snapshot-assertions/pull/152
- Add PHP 8.2 Support by @patinthehat in https://github.com/spatie/phpunit-snapshot-assertions/pull/151
- Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/153
- Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/159
- Fix badge with
run-testsstatus inREADME.mdby @gomzyakov in https://github.com/spatie/phpunit-snapshot-assertions/pull/160 - add support for PHPUnit v10 by @freekmurze in https://github.com/spatie/phpunit-snapshot-assertions/pull/154
New Contributors
- @patinthehat made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/152
- @dependabot made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/153
- @gomzyakov made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/160
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.16...5.0.0
-
4.2.1703 May 2024Release notes
Open source →What's Changed
- Update symfony version in deps by @Niolak in https://github.com/spatie/phpunit-snapshot-assertions/pull/196
- Fix/v4 permissions snapshot files by @Niolak in https://github.com/spatie/phpunit-snapshot-assertions/pull/201
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.16...4.2.17
-
4.2.1610 Oct 2022Release notes
Open source →What's Changed
- serialize empty HTML by @Khartir in https://github.com/spatie/phpunit-snapshot-assertions/pull/148
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.15...4.2.16
-
4.2.1525 Aug 2022Release notes
Open source →What's Changed
- Apply PCRE_UTF8 for cleaning filename by @su-kun1899 in https://github.com/spatie/phpunit-snapshot-assertions/pull/147
New Contributors
- @su-kun1899 made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/147
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.14...4.2.15
-
4.2.1429 Jul 2022Release notes
Open source →What's Changed
- Add tests for Text Driver and Windows EOL fixes by @mallardduck in https://github.com/spatie/phpunit-snapshot-assertions/pull/146
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.13...4.2.14
-
4.2.1326 Jun 2022Release notes
Open source →What's Changed
- Add test to cover HTML without doctype by @mallardduck in https://github.com/spatie/phpunit-snapshot-assertions/pull/144
- Add type safe json matching by @cschindl in https://github.com/spatie/phpunit-snapshot-assertions/pull/145
New Contributors
- @cschindl made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/145
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.12...4.2.13
-
4.2.1231 May 2022Release notes
Open source →What's Changed
- Use
LIBXML_HTML_NODEFDTDto maintain output consistency by @JayBizzle in https://github.com/spatie/phpunit-snapshot-assertions/pull/141
New Contributors
- @JayBizzle made their first contribution in https://github.com/spatie/phpunit-snapshot-assertions/pull/141
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.11...4.2.12
- Use
-
4.2.1118 Mar 2022Nothing published for this version
-
4.2.1008 Feb 2022Nothing published for this version
-
4.2.903 Dec 2021Nothing published for this version
-
4.2.802 Dec 2021Nothing published for this version
-
4.2.709 Jul 2021 -
4.2.620 Apr 2021 -
4.2.527 Jan 2021 -
4.2.426 Nov 2020 -
4.2.303 Nov 2020 -
4.2.201 Jun 2020Release notes
Open source →- moves default implementation of snapshot directory/id to concerns directory (#99)
-
4.2.119 May 2020 -
4.2.011 May 2020 -
4.1.008 Apr 2020 -
4.0.011 Feb 2020Release notes
Open source →Snapshots generated with
assertMatchesSnapshotwill break when upgrading to this version. The easiest way to upgrade is to ensure your snapshot tests pass, delete your snapshots, upgrade the package, then rerun the tests to generate new snapshots.- New snapshot formats when using
assertMatchesSnapshot: scalars (strings, integers & floats) are serialized totxtfiles, objects & arrays are serialized toyamlfiles - New
TextDriverto store snapshots intxtfiles - New
ObjectDriverto serialize data to YAML and store snapshots inyamlfiles - Removed
VarDriver
- New snapshot formats when using
-
3.1.110 Feb 2020 -
3.1.002 Dec 2019 -
3.0.022 Nov 2019Release notes
Open source →assertMatchesJsonSnapshotnow supports all JSON serializable objects, and won't convert empty arrays to obejcts anymore
-
2.2.121 Nov 2019 -
2.2.023 Oct 2019 -
2.1.307 Aug 2019 -
2.1.227 Mar 2019 -
2.1.104 Mar 2019 -
2.1.007 Feb 2019 -
2.0.029 Jan 2019Release notes
Open source →- Use YAML by default for associative arrays
- Drop PHP 7.0 support, the new constraint is ^7.1
- Drop PHPUnit ^6.5 support, the new constraint is ^7.0
-
1.4.213 May 2019Nothing published for this version
-
1.4.129 Jan 2019 -
1.4.029 Jan 2019 -
1.3.318 Dec 2018 -
1.3.218 Oct 2018 -
1.3.108 Jun 2018 -
1.3.022 May 2018 -
1.2.315 Mar 2018 -
1.2.214 Mar 2018 -
1.2.102 Feb 2018