PackageTrack
Sign in Get early access

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 2026
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 72
  1. 5.4.0 29 Apr 2026
    Release notes

    What's Changed

    • Add 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.
    • Drop the 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.
    • The wrapper restores the prior UPDATE_SNAPSHOTS env 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() and shouldCreateSnapshots() now check the env var first, then fall back to the legacy CLI argument.
    • Fix tests on PHPUnit 12.5+, where mocks throwing 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

    Open source →
    Release notes

    What's Changed

    • Add 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.
    • Drop the 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.
    • The wrapper restores the prior UPDATE_SNAPSHOTS env 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() and shouldCreateSnapshots() now check the env var first, then fall back to the legacy CLI argument.
    • Fix tests on PHPUnit 12.5+, where mocks throwing 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

    Open source →
  2. 5.3.2 09 Feb 2026
    Release notes

    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

    Open source →
    Release notes

    What's Changed

    • Fix BC break in getSnapshotId() from named snapshots feature — restored original no-parameter signature
    • Add README documentation for named snapshots
    Open source →
  3. 5.3.1 08 Feb 2026
    Release notes

    What's Changed

    • Allow PHPUnit 13
    Open source →
    Release notes

    What's Changed

    • Allow PHPUnit 13
    Open source →
  4. 5.3.0 22 Jan 2026
    Release notes

    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

    Open source →
    Release notes

    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

    Open source →
  5. 5.2.3 14 Nov 2025
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 5.2.2...5.2.3

    Open source →
    Release notes

    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

    Open source →
  6. 5.2.2 19 Aug 2025
    Release notes

    What's Changed

    Full Changelog: 5.2.1...5.2.2

    Open source →
    Release notes

    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

    Open source →
  7. 5.2.1 02 Jul 2025
    Release notes

    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 assertMatchesJsonSnapshot to accept any JSON-serializable value by @LuckyWindsck in #216

    New Contributors

    Full Changelog: 5.2.0...5.2.1

    Open source →
    Release notes

    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 assertMatchesJsonSnapshot to 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

    Open source →
  8. 5.2.0 08 May 2025
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 5.1.8...5.2.0

    Open source →
    Release notes

    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

    Open source →
  9. 5.1.8 10 Feb 2025
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 5.1.7...5.1.8

    Open source →
    Release notes

    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

    Open source →
  10. 5.1.7 09 Dec 2024
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 5.1.6...5.1.7

    Open source →
    Release notes

    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

    Open source →
  11. 5.1.6 03 May 2024
    Release notes

    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

    Open source →
  12. 5.1.5 20 Feb 2024
    Release notes

    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

    Open source →
  13. 5.1.4 03 Feb 2024
    Release notes

    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

    Open source →
  14. 5.1.3 29 Nov 2023
    Release notes

    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

    Open source →
  15. 5.1.2 11 Oct 2023
    Release notes

    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

    Open source →
  16. 5.1.1 12 Sep 2023
    Release notes
    • fix image driver
    Open source →
  17. 5.1.0 11 Sep 2023
    Release notes

    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

    Open source →
  18. 5.0.2 20 Apr 2023

    Nothing published for this version

  19. 5.0.1 13 Feb 2023
    Release notes

    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

    Open source →
  20. 5.0.0 09 Feb 2023
    Release notes

    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-tests status in README.md by @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

    Open source →
  21. 4.2.17 03 May 2024
    Release notes

    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

    Open source →
  22. 4.2.16 10 Oct 2022
    Release notes

    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

    Open source →
  23. 4.2.15 25 Aug 2022
    Release notes

    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

    Open source →
  24. 4.2.14 29 Jul 2022
    Release notes

    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

    Open source →
  25. 4.2.13 26 Jun 2022
    Release notes

    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

    Open source →
  26. 4.2.12 31 May 2022
    Release notes

    What's Changed

    • Use LIBXML_HTML_NODEFDTD to 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

    Open source →
  27. 4.2.11 18 Mar 2022

    Nothing published for this version

  28. 4.2.10 08 Feb 2022

    Nothing published for this version

  29. 4.2.9 03 Dec 2021

    Nothing published for this version

  30. 4.2.8 02 Dec 2021

    Nothing published for this version

  31. 4.2.7 09 Jul 2021
    Release notes
    • clean filenames on MatchesFileSnapshot for Windows (#130)
    Open source →
  32. 4.2.6 20 Apr 2021
    Release notes
    • allow using env vars to manage snapshot creation and update (#126)
    Open source →
  33. 4.2.5 27 Jan 2021
    Release notes
    • add support for PHP 7.3
    Open source →
  34. 4.2.4 26 Nov 2020
    Release notes
    • add support for PHP 8
    Open source →
  35. 4.2.3 03 Nov 2020
    Release notes
    • migrate phpunit config
    Open source →
  36. 4.2.2 01 Jun 2020
    Release notes
    • moves default implementation of snapshot directory/id to concerns directory (#99)
    Open source →
  37. 4.2.1 19 May 2020
    Release notes
    • Fix exception message
    Open source →
  38. 4.2.0 11 May 2020
    Release notes
    • Fixed inconsistent line endings
    • Improved Windows support
    Open source →
  39. 4.1.0 08 Apr 2020
    Release notes
    • Added --without-creating-snapshots flag
    Open source →
  40. 4.0.0 11 Feb 2020
    Release notes

    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.

    • New snapshot formats when using assertMatchesSnapshot: scalars (strings, integers & floats) are serialized to txt files, objects & arrays are serialized to yaml files
    • New TextDriver to store snapshots in txt files
    • New ObjectDriver to serialize data to YAML and store snapshots in yaml files
    • Removed VarDriver
    Open source →
  41. 3.1.1 10 Feb 2020
    Release notes
    • Add support for PHPUnit 9 (#86)
    Open source →
  42. 3.1.0 02 Dec 2019
    Release notes
    • Drop support for PHP 7.3
    Open source →
  43. 3.0.0 22 Nov 2019
    Release notes
    • assertMatchesJsonSnapshot now supports all JSON serializable objects, and won't convert empty arrays to obejcts anymore
    Open source →
  44. 2.2.1 21 Nov 2019
    Release notes
    • Allow symfony 5 components
    Open source →
  45. 2.2.0 23 Oct 2019
    Release notes
    • Added an assertMatchesHtmlSnapshot assertion
    Open source →
  46. 2.1.3 07 Aug 2019
    Release notes
    • Allow recursive mkdir for file snapshots
    Open source →
  47. 2.1.2 27 Mar 2019
    Release notes
    • Less restrictive symfony/yaml version requirement
    Open source →
  48. 2.1.1 04 Mar 2019
    Release notes
    • Fix for json driver
    Open source →
  49. 2.1.0 07 Feb 2019
    Release notes
    • Require PHPUnit 8 & PHP 7.2
    Open source →
  50. 2.0.0 29 Jan 2019
    Release notes
    • 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
    Open source →
  51. 1.4.2 13 May 2019

    Nothing published for this version

  52. 1.4.1 29 Jan 2019
    Release notes
    • Fix JSON array comparisons
    Open source →
  53. 1.4.0 29 Jan 2019
    Release notes
    • Allow arrays to be serialized to JSON
    Open source →
  54. 1.3.3 18 Dec 2018
    Release notes
    • Fix updating failed file-snapshots
    Open source →
  55. 1.3.2 18 Oct 2018
    Release notes
    • Fix for tests with weird characters
    Open source →
  56. 1.3.1 08 Jun 2018
    Release notes
    • Lowered minimum required PHPUnit version
    Open source →
  57. 1.3.0 22 May 2018
    Release notes
    • Only mark test incomplete after every snapshot has been run
    Open source →
  58. 1.2.3 15 Mar 2018
    Release notes
    • Fixed snapshot creation in recursive directories
    Open source →
  59. 1.2.2 14 Mar 2018
    Release notes
    • Support PHP 7.2
    Open source →
  60. 1.2.1 02 Feb 2018
    Release notes
    • Support phpunit ^7.0
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive