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.
Feature bets this package directly enables
new Mysqldump($dsn,...) → start($path)) gets you a real SQL dump artifact without shipping or depending on a mysqldump binary in the container. This is the fastest path to "download my workspace data" — a common enterprise procurement checkbox and a churn-reduction feature.setTableWheres() (per-table WHERE clauses) you can scope a dump to a single customer, and with setTransformTableRowHook() you can redact/mask columns such as SSNs or tokens at export time. That converts a compliance obligation into a config-driven task rather than a bespoke script.no-data (schema-only) and exclude-tables (regex supported) is the "build vs. buy" answer for a safe staging seed pipeline. This is usually the single highest-leverage use in a Laravel org: fewer PII incidents, faster onboarding, reproducible demo environments.single-transaction, no-autocommit, add-drop-table, insert-ignore, reset-auto-increment give you a dump that can be re-imported idempotently — useful for tenant cloning, sandbox provisioning, and "restore to yesterday" support workflows.no-data on a schedule and diffing gives you a low-effort guardrail against undocumented production migrations.Build vs. buy
mysqldump binary (more battle-tested, but couples you to container/system image and to process-execution permissions), or a managed DB snapshot feature from the cloud provider (best durability and PITR, but poor tenant-scoped granularity and awkward for on-demand customer exports). The package wins specifically where you need per-tenant, row-filtered, redacted, PHP-invoked dumps.Roadmap placement
Good fit
mysqldump binary or exec() availability in your runtime (shared hosting, hardened containers, some PaaS images). The README calls out restoring from a file "when no mysql executable is available" as a differentiator.Look elsewhere / push back
config/backup.php, Artisan commands, events) — that's spatie/laravel-backup territory, though note that package shells out to mysqldump and so inherits the binary dependency you may be trying to escape.mysqldump" (good for correctness, brittle for maintenance). Budget for pinning the version, owning the wrapper in-repo, and having a fallback plan (binary dump or provider snapshots) if the package stalls.max_execution_time limits, so jobs must be queued with generous timeouts; lock-tables/single-transaction defaults matter for read-replica and high-write production databases; and the DB user needs SELECT, SHOW VIEW, TRIGGER, and LOCK TABLES privileges — a permissions change that often requires a security review.pdoSettings default of PDO::ATTR_PERSISTENT => true is worth an explicit override decision in a queue-worker context.To executives (30 seconds). We can ship customer data exports, safe staging refreshes, and compliance-grade redacted extracts using a mature, widely-used open-source PHP library instead of building dump logic ourselves — roughly a week of wrapper work instead of a multi-sprint project, and without adding a system binary to our deployment. Two caveats to fund properly: the license is GPL-3.0, so it needs a legal check if we ever distribute our code, and it is a data-extraction tool, not a replacement for cloud database backups — we should keep paying for managed snapshots as our real recovery guarantee.
To engineering. It's a drop-in Composer package with a small, readable API: construct with a PDO DSN, optionally register row-transform and per-table WHERE/LIMIT hooks, then start($path). Real advantages over shelling out: hex-encoded binary blobs (a correctness issue naive dumpers get wrong), routines/events/views/triggers in one artifact, gzip/bzip2 output, and no exec() dependency. Real costs: no Laravel integration whatsoever — no provider, no config, no queue, no Storage disk abstraction — so we own a thin wrapper; dumps are full-logical and memory/time-sensitive, so they belong in queue jobs with tuned timeouts and an explicit ATTR_PERSISTENT decision; and the codebase is single-maintainer with self-described rough test tooling, so pin the version and keep the wrapper behind an interface so a mysqldump-based or provider-snapshot implementation can be swapped in. Also note it's MySQL-only and the DB user needs elevated privileges (SELECT, SHOW VIEW, TRIGGER, LOCK TABLES).
To security/compliance. The two capabilities that matter are row-level filtering for tenant-scoped exports and a transform hook for redacting PII at dump time — meaning masked data is the default for non-production copies rather than a manual follow-up step. Ask for: scoped DB credentials per environment, encrypted storage of every artifact, retention limits with automatic deletion, audit logging of who exported what and when, and a rule that raw dumps of production PII are never written to developer-accessible storage.
Ask. Approve a small spike (wrapper behind an interface + one use case, likely anonymized staging refresh) to validate dump size, runtime, and restore fidelity against a production-sized dataset; return with a license opinion and a recommendation on customer-facing export as a roadmap item.
How can I help you explore Laravel packages today?