ifsnop/mysqldump-php
MySQLDump-PHP is a dependency-free, pure-PHP library that recreates mysqldump: back up table structures, data, views, triggers, stored routines and events, with compression, hooks, hex blobs, virtual columns and direct restore. No MySQL binary is required, and output matches the original mysqldump.
Architecture fit. ifsnop/mysqldump-php is a framework-agnostic, pure-PHP reimplementation of the mysqldump CLI. Its entire public surface is a constructor (PDO DSN + credentials + dumpSettings + pdoSettings), a start($filenameOrStream) call, and a handful of hooks (setTransformTableRowHook, setInfoHook, setTableWheres, setTableLimits). It has no Laravel service provider, no config file, no facade, and no framework coupling — which cuts both ways: it will not fight Laravel's container, but the integration is entirely ours to build. It is a point-in-time logical dump tool, not a backup framework; it does not schedule, rotate, verify, encrypt, or ship artifacts. Treat it as a driver, not a solution.
Technical risk (ranked).
hex-blob output, stored routines, events, virtual columns, insert-ignore, and dump-time row transformation. But the parity-with-mysqldump testing is self-described as fragile, and there is no published conformance report against MySQL 8.0/8.4 or MariaDB.max_execution_time, and connection lifetime all become backup-failure modes. This is a different operational shape than shelling out to a client binary.Where it genuinely wins. Environments where the mysqldump binary is unavailable or unusable: managed MySQL (RDS/Aurora), containerized PHP-FPM images without the MySQL client, shared hosting, and CI runners. It also enables row-level PII transformation at dump time — a materially better story for producing GDPR-safe staging/dev datasets than post-processing a raw dump.
Key questions for the maintainer/vendor review.
caching_sha2_password auth, utf8mb4_0900_ai_ci, JSON, spatial types, and invisible/generated columns without corruption?mysqldump compatibility gaps are known and documented?Stack fit. Composer-installable, PSR-4 autoloaded (Ifsnop\Mysqldump\Mysqldump), PDO-based. Its PHP 5.3 floor means it runs anywhere our Laravel 9–11 / PHP 8.1–8.3 estate runs — but the floor also means the code has not been modernized, so we should pin an exact version and add it to our dependency-risk register rather than treat it as an evergreen library. It relies on pdo_mysql; confirm the extension is present in every runtime image, including queue workers and scheduled-task containers.
There is no Laravel package — we write one. Scope it as a thin internal adapter, roughly one sprint:
config/backup.php mapping dumpSettings to env-overridable keys.Dumper interface, so the implementation is swappable.db:dump) and a queued Job wrapper, so dumps never run on the request path.Storage disks (the library's stream-wrapper support makes S3/GCS targets feasible).setTransformTableRowHook wired to a declarative, per-table PII redaction config — this is the highest-value internal feature and should be designed up front, not bolted on.Migration path. If we currently shell out to mysqldump or use spatie/laravel-backup, do not rip it out. Introduce the Dumper interface, run the new adapter in parallel in staging for two to four weeks, and compare outputs by schema checksum, per-table row counts, and a restore drill into a scratch database. Promote to production only for non-critical databases first. Keep the legacy path behind a config flag for one release cycle.
Compatibility work to sequence early.
SELECT, plus SHOW VIEW, TRIGGER, and LOCK TABLES where relevant. Managed services often withhold LOCK TABLES; prefer single-transaction (already the default) and confirm MyISAM tables aren't in scope.utf8mb4 setting, not the default utf8 alias) with an emoji/4-byte round-trip test.skip-definer and no-create-db behavior for cross-environment restores.Sequencing. (1) Legal ruling on GPL-3.0 → (2) maintainer-health and feature-gap spike against a production-like snapshot → (3) adapter + config + tests → (4) staging parity and restore drill → (5) PII hook rollout to staging data → (6) production pilot on one non-critical service → (7) general availability with documented runbook.
Maintenance. Single-maintainer risk with a GPL obligation attached. Assume we may need to vendor a pinned fork; budget a small ongoing owner (roughly 10–15% of one engineer) for version bumps, MySQL-version compatibility checks, and security review. Because the license is GPL-3.0, internal patches carry no distribution trigger — but if we ever distribute the application, our patch set becomes distributable source. Codify that boundary now.
Support. Community-only: GitHub issues, a wiki, no vendor SLA, no CVE process we can subscribe to. Escalation = we fix it. For a backup path — a tier-0 recoverability control — that is a real exposure and should be reflected in the risk register with a named fallback (the mysqldump binary or a managed-snapshot service) that we test quarterly.
Scaling. Dumps are CPU- and memory-bound in PHP, single-threaded, with no parallelism across tables. Large tables will hit memory_limit and max_execution_time unless we tune them, stream to disk/object storage, or shard the job per table using include-tables. Compression reduces storage and network but adds CPU. setTableLimits and setTableWheres are the pragmatic levers for dev/staging datasets; production backups should not use them. Note the defaults enable lock-tables and single-transaction — confirm which path actually executes on your engine mix before promising zero-lock behavior.
Failure modes to instrument.
.tmp and atomically rename; emit a size-delta alert.DEFINER clauses or charset mismatches — only a restore drill catches these.skip-tz-utc defaults.Ramp-up. Low for engineers — the documented API is small and the README covers most settings. A mid-level PHP developer is productive in a day, but the operational competence (privileges, restore validation, PII hook design) is where the effort sits. Plan for a written runbook, a restore drill as an acceptance gate, and a half-day knowledge transfer to whoever carries the on-call pager.
Verdict. Adopt conditionally: strong technical fit for binary-free dumping and PII-safe dataset generation, but only after a legal ruling on GPL-3.0 and a maintainer-health spike. Do not adopt it as the sole production backup mechanism without a tested fallback.
How can I help you explore Laravel packages today?