DEV.co
Open-Source Databases · spatie

db-dumper

db-dumper is a PHP library that simplifies database backups by wrapping native dump utilities (mysqldump, pg_dump, etc.) into a clean API. It supports MySQL, MariaDB, PostgreSQL, SQLite, and MongoDB with options to filter tables, exclude data, and compress output.

Source: GitHub — github.com/spatie/db-dumper
1.2k
GitHub stars
160
Forks
PHP
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryspatie/db-dumper
Ownerspatie
Primary languagePHP
LicenseMIT — OSI-approved
Stars1.2k
Forks160
Open issues0
Latest release4.1.1 (2026-05-04)
Last updated2026-06-26
Sourcehttps://github.com/spatie/db-dumper

What db-dumper is

A lightweight PHP wrapper around system dump binaries that provides fluent method chaining for database export. Supports selective table inclusion/exclusion, AUTO_INCREMENT control, compression (gzip/bzip2), and URL-based credential parsing across five database engines.

Quickstart

Get the db-dumper source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/spatie/db-dumper.gitcd db-dumper# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Automated Backup Pipelines

Integrate into scheduled backup jobs or CI/CD workflows to programmatically dump production/staging databases with consistent configuration and compression.

Database Migration & Cloning

Quickly export specific tables or full schemas for cross-environment replication, testing, or data transfer between servers.

Development & Testing Fixtures

Generate sanitized database snapshots by excluding sensitive tables (logs, sessions) while keeping schema and non-critical data.

Implementation considerations

  • All required dump binaries (mysqldump, pg_dump, sqlite3, mongodump, gzip, bzip2) must be present and in PATH or configured via setDumpBinaryPath().
  • Credentials are passed via CLI arguments or environment; ensure proper secret management (avoid hardcoding in config or logs).
  • Large database dumps can consume significant disk space and I/O; plan storage and monitor execution time.
  • Database connectivity must be verified before dump execution; handle connection failures gracefully in automation.
  • File permissions on output directory must allow write access and proper cleanup of old dumps to prevent disk exhaustion.

When to avoid it — and what to weigh

  • Real-time streaming or incremental replication — This tool creates point-in-time full dumps only; not suitable for continuous replication or change-data-capture (CDC) scenarios.
  • Missing system binaries in containerized/serverless environments — Requires native dump utilities (mysqldump, pg_dump, etc.) on the execution host; may complicate Docker or Lambda deployments.
  • Large uncompressed dumps with limited disk I/O — No built-in streaming or direct cloud upload; dumps write to local filesystem first, risking storage saturation on disk-constrained systems.
  • Encrypted or highly restricted database access — Relies on basic credential methods (username/password); no support for advanced auth (IAM roles, Kerberos, certificate-based auth).

License & commercial use

MIT License: permissive open-source license allowing unrestricted use, modification, and distribution (commercial and proprietary) provided the original license and copyright notice are retained.

MIT is a widely recognized permissive OSI license suitable for commercial applications. No legal review required from Devco perspective, but audit your own license compliance process if bundling or redistributing.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Credentials are passed to system binaries via CLI; ensure passwords are not logged or exposed in process listings. Relies on underlying database server and dump utility security. No input validation details provided; review or test command injection resistance if passing user-supplied database/table names. Dumps are unencrypted on disk; secure file storage and transmission separately.

Alternatives to consider

mysqldump / pg_dump (native CLIs)

Direct use avoids a PHP dependency but requires shell scripting, credential handling, and error management; less elegant for Laravel apps.

Backup APIs (AWS RDS Snapshots, Google Cloud SQL backups)

Cloud-native approach with managed encryption and retention; avoids local dump overhead but locks you into a cloud vendor and cannot selectively exclude tables at dump time.

Laravel backups package (Spatie)

Higher-level orchestration tool that builds on db-dumper with scheduling, notifications, and cleanup; overkill if you only need programmatic dumps without full backup lifecycle management.

Software development agency

Build on db-dumper with DEV.co software developers

Our DevOps and web development teams can integrate db-dumper into your automated backup pipeline with monitoring, encryption, and disaster recovery workflows.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

db-dumper FAQ

Do I need to install MySQL/PostgreSQL servers to use db-dumper?
No. You only need the command-line dump utilities (mysqldump, pg_dump, etc.) and network access to the target database. The database server itself can run anywhere.
Can I exclude sensitive data (PII, passwords) from dumps?
You can exclude entire tables via excludeTables() or exclude only data (keeping structure) via excludeTablesData(). To redact specific columns, you must pre-process the SQL output or use a separate sanitization tool.
How large can dumps be, and will they block my application?
No hard limit; depends on available disk I/O and system memory. Dumps are synchronous and will block the calling PHP process. For large databases, run dumps asynchronously (queue job, cron, separate worker) to avoid blocking requests.
Is db-dumper suitable for production backups?
Yes, if integrated into a robust backup strategy (async execution, retry logic, encryption at rest, off-site replication, verified restore testing). db-dumper provides the dump mechanism; you must add monitoring, alerting, and recovery procedures.

Software development & web development with DEV.co

Adopting db-dumper is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Need a robust backup strategy?

Our DevOps and web development teams can integrate db-dumper into your automated backup pipeline with monitoring, encryption, and disaster recovery workflows.