rah/danpu
Danpu is a lightweight PHP library for dumping and restoring MySQL/MariaDB databases. Export schema and data to SQL files, optionally gzip-compressed, then import them again through a simple API or CLI, without relying on mysqldump binaries.
Architecture fit
rah/danpu is a framework-agnostic, pure-PHP MySQL dump library (namespace Rah\Danpu), not a Laravel package. There is no service provider, facade, config publish, or contract binding — it is an infrastructure primitive you would wrap yourself.SELECT * + implode approaches fail.database.connections.mysql with a thin adapter — low conceptual distance from our existing stack.mysqldump binary, not for a backup platform. It handles dump generation and (basic) import; it does not handle scheduling, retention, offsite storage, encryption, or restore verification. Those remain ours.Integration feasibility
Rah\Danpu\Dump config, expose an Export call from an artisan command or queued job.Storage disks — we would need a temp-file-then-move pattern to reach S3 or similar).mysqldump, the mature path is spatie/db-dumper or spatie/laravel-db-snapshots; Danpu only wins where the binary is unavailable (managed container images, restricted shared hosting, hardened PaaS) or where binary version drift is a support burden.Technical risk
implode argument order) and possible fatals. This must be proven on our exact PHP version before any commitment.BLOB, or mangles a DEFINER/DELIMITER block is discovered only at restore time — the worst possible moment. Import-side SQL parsing (statement splitting) is historically the fragile part of this class of library.--single-transaction-equivalent for InnoDB is a question we must answer from source, not docs. If it does not, dumps of a live write-heavy database will be internally inconsistent.Key questions
exec('mysqldump')? If yes, this entire evaluation is moot and we should use the standard wrapper.error_reporting(E_ALL) — fatal-free, not merely deprecation-free?--lock-tables equivalents?DEFINER clauses, generated columns, and non-UTF8MB4 charsets?Stack fit
DatabaseDumper contract with a DanpuDumper implementation — so it stays swappable for spatie/db-dumper later without touching call sites.config('database.connections.mysql') into Rah\Danpu\Dump (->host(), ->port(), ->dbname(), ->user(), ->password(), ->file(), ->tmpDir(), plus include/ignore table filters). Keep this adapter the only place that knows Danpu exists.storage/app/backups (or a tmp dir) via tmpDir, then hand off the finished artifact to our existing filesystem/Storage layer for promotion, retention, and offsite copy.Migration path
DatabaseDumper interface so rollback is a one-line config change.Compatibility
rah/danpu), and pin a known-good PHP version range in the wrapper's tests. Run the CI matrix against every PHP minor we ship.PDO extension assumptions (it requires pdo_mysql), zlib for compressed output, and available disk in tmpDir for the compression path.caching_sha2_password auth, utf8mb4_0900_ai_ci collations, information_schema differences) and, if applicable, MariaDB — this is a likely source of silent breakage given the library's 2018 vintage.Sequencing
Maintenance
Support
Scaling
tmpDir headroom for compression, and the destination filesystem. Large databases (tens of GB) will need disk capacity planning and a cleanup contract for partial artifacts.Failure modes
information_schema and an explicit "dump complete" trailer check.DELIMITER blocks, stored routines, triggers, or binary/BLOB payloads. Mitigate by excluding routines/triggers from Danpu's scope and managing them via migrations, and by requiring a successful restore drill as acceptance.tmpDir: compression temp files fill the volume and take down other workloads. Mitigate with quota/size guards and pre-flight capacity checks.information_schema handling. Mitigate with a table-count assertion comparing source and dump.Ramp-up
Export/Import, and a working prototype is hours, not days. The real ramp-up cost is not the library — it is building the surrounding discipline (restore drills, canary backups, artifact verification) that any backup mechanism requires.Bottom line for the TPM: technically sound design for a narrow constraint (no mysqldump binary), but a stale, single-maintainer, zero-adoption dependency that we would effectively own. Adopt only behind a swappable interface, with a fork policy, a canary backup, and a proven restore drill — otherwise use the standard db-dumper / db-snapshots path.
How can I help you explore Laravel packages today?