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.
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.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.--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.--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.Adopt when most of the following hold:
--stream option and the recent chunk-boundary fix make multi-GB restores feasible.logging or tenant database) and per-connection dump flags, which the dump.addExtraOption hook covers.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:
cleanup --keep=N, no encryption, no verification, and no point-in-time recovery. That is spatie/laravel-backup or managed infrastructure, not this.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.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.
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.
How can I help you explore Laravel packages today?