Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Snapshots Laravel Package

spiral/snapshots

Laravel snapshot testing helpers for asserting arrays, JSON, and HTTP responses against stored snapshots. Generate, update, and compare snapshots in tests to catch unexpected changes with clear diffs and simple PHPUnit integration.

View on GitHub
Deep Wiki
Context7

Getting Started

This package provides a set of interfaces for defining exception handling behavior within the Spiral Framework—specifically, it defines the SnapshotsInterface used to mark exception handlers that should capture and store snapshot data (e.g., for debugging, logging, or replay). Since it's a subtree split and last released in 2019, it’s primarily relevant if you’re working with older Spiral Framework versions (v2.x). To begin, install it via Composer if your project depends on legacy Spiral components (composer require spiral/snapshots). Its interfaces (Spiral\Snapshots\SnapshotsInterface) are typically implemented by custom exception handlers, and registered via Spiral’s container bindings or auto-wiring. First, locate how Spiral\Snapshots\SnapshotsInterface is used in your app—usually in a custom ExceptionHandler that implements this interface to indicate snapshot capture is enabled.

Implementation Patterns

  • Snapshot-Enabled Exception Handlers: Implement SnapshotsInterface in your custom exception handler to signal that the handler should produce a "snapshot" (a serializable representation of the exception state) for later inspection or replay.
  • Integration with Spiral Framework: Used in conjunction with Spiral\Exceptions\HandlerInterface—often, handlers implement both HandlerInterface and SnapshotsInterface.
  • Snapshot Storage & Replay: Handlers returning snapshots typically store them (e.g., in files, DB, or Redis) or send them to external services (e.g., Sentry-style integrations). You may implement SnapshotInterface (in a sibling package like spiral/snapshots-store) for serialization.
  • Conditional Snapshots: Implement logic inside your handler’s handle() method to return a snapshot only for certain exceptions (e.g., 5xx errors, not 4xx), enabling fine-grained control over debugging fidelity.

Gotchas and Tips

  • Deprecation Warning: This package is effectively frozen (2019) and part of an older Spiral architecture. Modern Spiral (v3+) uses spiral/framework directly and deprecates snapshots in favor of spiral/exceptions with built-in snapshot support. Avoid new reliance unless maintaining legacy apps.
  • Interface-only Package: It contains only interfaces—no concrete implementations. You need other components (e.g., spiral/exceptions, spiral/framework) to make it functional.
  • Namespace Clash Risk: If upgrading Spiral, ensure Spiral\Snapshots is removed or aliased to avoid conflicts with newer Spiral\Exceptions types.
  • Container Binding: When registering custom handlers, ensure they’re bound to ExceptionHanlderInterface and tagged as snapshots-enabled (via interface matching or explicit binding in Bootloader).
  • Testing Tip: Mock SnapshotsInterface in unit tests to verify your handler’s snapshot logic without relying on external storage.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport