spatie/phpunit-snapshot-assertions
Add snapshot testing to PHPUnit. Save expected output (JSON, arrays, strings, etc.) on first run and automatically compare on later runs to catch regressions with minimal assertions. Includes handy traits and snapshot update workflow for tests.
assertMatchesJsonSnapshot($response->toJson())).artisan migrate) remain consistent.--parallel via CREATE_SNAPSHOTS=false.spatie/pixelmatch-php).update-snapshots runs).For Executives: "This package lets us automate ‘golden master’ testing for APIs, CLI tools, and outputs—reducing test maintenance by 30–50% while catching regressions early. For example, if a developer changes an API response format, the test fails immediately with a diff, saving hours of debugging. It’s a no-code solution that works alongside our existing PHPUnit tests, with zero infrastructure changes. ROI: Faster releases, fewer production bugs."
For Engineers:
*"Snapshot testing replaces flaky assertions like assertEquals($expectedJson, $response->toJson()) with automated diffs. Key benefits:
composer update-snapshots or UPDATE_SNAPSHOTS=true phpunit to approve changes.spatie/pixelmatch-php), and custom drivers.
Works with Laravel, Symfony, or vanilla PHP. CI-friendly with CREATE_SNAPSHOTS=false."*For QA/DevOps: *"This integrates with your existing PHPUnit workflow:
CREATE_SNAPSHOTS=false to fail on missing snapshots (no silent creation).--parallel via env vars.How can I help you explore Laravel packages today?