NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #833 most downloaded on Packagist
Snapshot testing with PHPUnit
Latest stable
5.4.0
Last release 6 months ago
29 Apr 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 58 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
72 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Add vendor/bin/update-snapshots wrapper binary that sets UPDATE_SNAPSHOTS=true and runs PHPUnit. This replaces the previously documented phpunit -d --
vendor/bin/update-snapshots wrapper binary that sets UPDATE_SNAPSHOTS=true and runs PHPUnit. This replaces the previously documented phpunit -d --update-snapshots syntax, which abused PHPUnit's -d flag and produces a Failed to set "--update-snapshots=1" test runner warning since PHPUnit 12.5.12.phpunit -d --without-creating-snapshots form from the README. Use the CREATE_SNAPSHOTS=false environment variable instead. The argv check is kept in shouldCreateSnapshots() for backwards compatibility.UPDATE_SNAPSHOTS env var state on shutdown, so it does not leak a state mutation to any in-process code that runs after PHPUnit.shouldUpdateSnapshots() and shouldCreateSnapshots() now check the env var first, then fall back to the legacy CLI argument.AssertionFailedError are tracked as a test failure even when user code catches the exception. The expectFail helper now uses a plain RuntimeException carrying the expected message.Closes #242.
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.3.2...5.4.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Fix BC break in getSnapshotId() from named snapshots feature — restored original no-parameter signature
getSnapshotId() from named snapshots feature — restored original no-parameter signatureFull Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.3.1...5.3.2
### What's Changed - Allow PHPUnit 13
Add support for PHPUnit 9.6 by @alex-dev in https://github.com/spatie/phpunit-snapshot-assertions/pull/235
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.3...5.3.0
Update issue template by @AlexVanderbist in https://github.com/spatie/phpunit-snapshot-assertions/pull/222
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.2...5.2.3
Bump aglipanci/laravel-pint-action from 2.5 to 2.6 by @dependabot[bot] in https://github.com/spatie/phpunit-snapshot-assertions/pull/217
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.1...5.2.2
Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/213
assertMatchesJsonSnapshot to accept any JSON-serializable value by @LuckyWindsck in https://github.com/spatie/phpunit-snapshot-assertions/pull/216Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.0...5.2.1
Allow setting yamlInline for ObjectDriver by @tassilogroeper 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
Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/207
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.7...5.1.8
Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/203
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.6...5.1.7
Minor updates and improvements by @patinthehat in https://github.com/spatie/phpunit-snapshot-assertions/pull/192
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.5...5.1.6
gha: run tests against PHP 8.3 too by @mfn in https://github.com/spatie/phpunit-snapshot-assertions/pull/188
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.4...5.1.5
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
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.3...5.1.4
Bump actions/setup-node from 3 to 4 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/181
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.2...5.1.3
Bump actions/setup-node from 2 to 3 by @dependabot in https://github.com/spatie/phpunit-snapshot-assertions/pull/176
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.1.1...5.1.2
- fix image driver
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
Nothing published for this version
Generate snapshot file names with dataset by @pierres in https://github.com/spatie/phpunit-snapshot-assertions/pull/163
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.0.0...5.0.1
Add Dependabot Automation by @patinthehat in https://github.com/spatie/phpunit-snapshot-assertions/pull/152
run-tests status in README.md by @gomzyakov in https://github.com/spatie/phpunit-snapshot-assertions/pull/160Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.16...5.0.0
Update symfony version in deps by @Niolak in https://github.com/spatie/phpunit-snapshot-assertions/pull/196
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.16...4.2.17
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
Apply PCRE_UTF8 for cleaning filename by @su-kun1899 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
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
Add test to cover HTML without doctype by @mallardduck in https://github.com/spatie/phpunit-snapshot-assertions/pull/144
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.12...4.2.13
Use LIBXML_HTML_NODEFDTD to maintain output consistency by @JayBizzle in https://github.com/spatie/phpunit-snapshot-assertions/pull/141
LIBXML_HTML_NODEFDTD to maintain output consistency by @JayBizzle in https://github.com/spatie/phpunit-snapshot-assertions/pull/141Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.11...4.2.12
revert match process in JsonDriver by @Stevemoretz in https://github.com/spatie/phpunit-snapshot-assertions/pull/138
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.10...4.2.11
Normalize windows line endings on HTML tests by @mallardduck in https://github.com/spatie/phpunit-snapshot-assertions/pull/136
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.9...4.2.10
Do not convert stdClass to array && remove outdated piece of code by @alshenetsky in https://github.com/spatie/phpunit-snapshot-assertions/pull/134
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.8...4.2.9
Update php-cs-fixer config by @gndk in https://github.com/spatie/phpunit-snapshot-assertions/pull/132
Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.7...4.2.8
clean filenames on MatchesFileSnapshot for Windows
allow using env vars to manage snapshot creation and update
- add support for PHP 7.3
- Add support for PHP 8.0
- migrate phpunit config
moves default implementation of snapshot directory/id to concerns directory
- Fix exception message
Fixed inconsistent line endings
Added --without-creating-snapshots flag
--without-creating-snapshots flag*Snapshots generated with assertMatchesSnapshot will break when upgrading to this version. The easiest way to upgrade is to ensure your snapshot tests
Snapshots generated with assertMatchesSnapshot will 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.
assertMatchesSnapshot: scalars (strings, integers & floats) are serialized to txt files, objects & arrays are serialized to yaml filesTextDriver to store snapshots in txt filesObjectDriver to serialize data to YAML and store snapshots in yaml filesVarDriver- add support for PHPUnit 9
- Drop support for PHP 7.3
assertMatchesJsonSnapshot now supports all JSON serializable objects, and won't convert empty arrays to obejcts anymore
assertMatchesJsonSnapshot now supports all JSON serializable objects, and won't convert empty arrays to obejcts anymore- Allow symfony 5 components
Added an assertMatchesHtmlSnapshot assertion
assertMatchesHtmlSnapshot assertionAllow recursive mkdir for file snapshots
Less restrictive symfony/yaml version requirement
- Fix for json driver
- Require PHPUnit 8 & PHP 7.2
Use YAML by default for associative arrays
Nothing published for this version
- Fix JSON array comparisons
Allow arrays to be serialized to JSON
Fix updating failed file-snapshots
Fix for tests with weird characters
Lowered minimum required PHPUnit version
Only mark test incomplete after every snapshot has been run
Fixed snapshot creation in recursive directories
- Support PHP 7.2
- Support phpunit ^7.0
One column per quarter.