Weave 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

Laravel Db Snapshots Laravel Package

spatie/laravel-db-snapshots

Spatie's Laravel package adding Artisan commands to instantly dump and load MySQL, PostgreSQL, or SQLite databases. Create named snapshots, load the latest, list, and clean up old dumps in seconds.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Developer environment strategy (build vs. buy vs. adopt). This is an adopt-off-the-shelf decision, not a build. For a few hours of integration (add a snapshots disk, optionally publish config), you get named, listable, loadable database snapshots across MySQL, PostgreSQL, SQLite, and MariaDB — instead of every engineer maintaining their own mysqldump/psql script and tribal knowledge about which dump is current.
  • Onboarding and time-to-first-PR. snapshot:create / snapshot:load --latest gives new hires (and CI jobs, and ephemeral preview environments) a one-command path to a realistic dataset instead of migrate:fresh --seed. That is a measurable DX lever: time-to-productive-environment and count of "works on my machine" data bugs.
  • Demo, sales, and stakeholder environments. Loading a known-good snapshot into a demo connection (--connection=...) turns "rebuild the demo instance" from a half-day chore into a repeatable, scriptable step — directly supporting sales demos, QA regression runs, and customer-facing sandboxes.
  • Incident reproduction and support. When a customer reports a bug, a named snapshot of the affected state can be captured, shared via the configured disk, and loaded locally. This shortens time-to-reproduce and reduces "we can't recreate it" churn — a support-cost argument as much as an engineering one.
  • Test and performance-data strategy. The --table/--exclude and --compress options make it viable to snapshot a curated subset (e.g., exclude log/queue/audit tables) for load testing, while keeping the artifact small enough to move around. This is a cheaper first step than procuring a dedicated data-masking or database-branching product.
  • Roadmap sequencing. Because it is a thin, MIT-licensed CLI layer, it can ship inside a DX/velocity epic without a procurement cycle, and it defers the harder (and more expensive) decisions — production-grade backup, PITR, and PII anonymization — to a separate, deliberately scoped initiative.

When to Consider This Package

Adopt when most of the following hold:

  • Your stack is Laravel with MySQL/MariaDB, PostgreSQL, or SQLite, and you want snapshots driven from Artisan rather than bespoke shell scripts.
  • Your problem is development, staging, QA, or demo data — not compliance-grade backup and restore.
  • You already have (or can add) a filesystem disk for storage; local or S3-compatible both work, since it goes through Laravel's filesystem abstraction.
  • Your dumps are large enough that in-memory loading hurts — the --stream option and the recent chunk-boundary fix make multi-GB restores feasible.
  • You need multi-connection support (e.g., a separate logging or tenant database) and per-connection dump flags, which the dump.addExtraOption hook covers.
  • You want hooks into the lifecycle; the six Creating/Created/Loading/Loaded/Deleting/Deleted events are enough to wire notifications, audit logging, or post-load seeding.

Look elsewhere — or scope additional work — when:

  • This is being proposed as your backup/DR solution. It has no scheduling, no retention policy beyond cleanup --keep=N, no encryption, no verification, and no point-in-time recovery. That is spatie/laravel-backup or managed infrastructure, not this.
  • Dumps contain PII and you have no anonymization step. Snapshots are raw dumps; pulling production data into laptops or demo environments without a masking pipeline is a compliance incident waiting to happen. Budget for that work explicitly.
  • You need branch-per-PR isolated databases with instant restore. Managed database branching (Neon, PlanetScale, or a snapshot-as-a-service) wins on isolation and speed; this package restores by dropping tables, which is destructive and single-target.
  • You cannot ship native mysqldump/pg_dump/sqlite3 binaries on the runtime (locked-down containers, managed runtimes), or client/server version drift is a known problem in your fleet.
  • The team is not on Laravel. The value is almost entirely in the Artisan ergonomics; a plain shell/docker approach is equivalent elsewhere.

Guardrails worth deciding up front: snapshot:load drops all tables by default, so treat it as a footgun — gate it behind environment checks or a wrapper command, and never leave it reachable from a production shell. Also set an explicit exclude list so caches, sessions, jobs, and audit tables don't bloat every artifact.

How to Pitch It (Stakeholders)

For executives — the one-paragraph version: This is a small, free, MIT-licensed addition from a well-known Laravel vendor (Spatie) that lets our engineers save and restore database states with a single command. It removes a recurring, low-glamour tax on the team: rebuilding realistic data environments by hand. Expected returns are faster onboarding, faster bug reproduction, and repeatable demo environments, bought for roughly a day of integration effort and no licensing cost or vendor lock-in. It is deliberately not our backup or disaster-recovery system, and it is not a place where customer data gets handled without a masking step — those remain separate decisions.

For engineering — the practical case: It is a thin wrapper around the standard database dump tools with sane Laravel defaults: configurable disk and connection, per-table include/exclude, optional gzip, streaming loads for large files, and lifecycle events for wiring into your own tooling. It tracks Laravel 11/12/13 and ships actively (recent work on streamed-load edge cases, Postgres meta-commands, and MariaDB support). Integration is composer require plus one disk config entry.

Risks to name openly, so nobody is surprised later: raw dumps contain whatever is in the database, so an anonymization or subsetting policy is a prerequisite for using production-derived data; the package shells out to native database clients, so container images need them installed and version-aligned; and the default load behavior drops tables, so we should wrap it rather than expose it. None of these are blockers — they are scoping items that determine whether this lands as a one-day DX win or quietly becomes a data-governance problem.

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.
thuraaung2493/laravel-rulecraft
cyberwizard/schedule-catchup
livetennisapi/livetennisapi-laravel
roundly-consulting/notifications-for-laravel
flightsadmin/bootstrap-starter-kit
lasserafn/laravel-intempus
likyly/sdk
tdt/input
coreation/php-shapefile
coreation/gisconverter
primix/widgets
primix/notifications
primix/actions
primix/tables
primix/details
primix/forms
primix/support
marcelgwerder/laravel-api-handler
firebrikdotcom/conveyor-laravel-broadcaster
kanata-php/conveyor-laravel-broadcaster