NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #728 most downloaded on Packagist
Snapshot testing with PHPUnit
Last release 5 months ago
29 Apr 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 54 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
72 releases · first in 2016
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: 5.3.2...5.4.0
One column per quarter.
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: 5.3.1...5.3.2
What's Changed Allow PHPUnit 13
Add support for PHPUnit 9.6 by @alex-dev in #235
Full Changelog: 5.2.3...5.3.0
Update issue template by @AlexVanderbist in #222
Full Changelog: 5.2.2...5.2.3
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 #217
Full Changelog: 5.2.1...5.2.2
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 #213
assertMatchesJsonSnapshot to accept any JSON-serializable value by @LuckyWindsck in #216Full Changelog: 5.2.0...5.2.1
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 #212
Full Changelog: 5.1.8...5.2.0
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 #207
Full Changelog: 5.1.7...5.1.8
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 #203
Full Changelog: 5.1.6...5.1.7
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
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
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
- 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
Your coding agent can read these notes before it upgrades. Set up the MCP server →