Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mysqldump Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

Feature bets this package directly enables

  • Self-serve data export / tenant data portability. A one-line API (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.
  • GDPR/CCPA-style data subject export and offboarding. Combined with 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.
  • Anonymized production → staging refresh. The row-transform hook plus 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.
  • Backup/restore in-app rather than in ops. 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.
  • Schema-drift snapshots as a release gate. Dumping with no-data on a schedule and diffing gives you a low-effort guardrail against undocumented production migrations.

Build vs. buy

  • The "buy" (i.e., adopt) case is strong only for the dump mechanics. Everything a Laravel PM actually needs around it — a service provider, config file, queue job, disk/storage abstraction, retention policy, signed download URLs, encryption at rest, progress UI, and restore verification — is not in the package. Plan for an internal wrapper as a first-class deliverable, not glue code.
  • Alternative paths: shelling out to the 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

  • Treat it as a Tier-2 enabling dependency, not a headline feature. Sequence: (1) internal wrapper + one safe use case (staging anonymization or tenant export), (2) queue it and store via Laravel Filesystem, (3) add retention/cleanup and audit logging, (4) only then consider customer-facing download UI.
  • Do not put it on the critical path for disaster recovery. It is a data-extraction tool, not a backup SLA guarantee — no incremental dumps, no point-in-time recovery, no built-in verification that the dump restores cleanly.

When to Consider This Package

Good fit

  • Your stack is MySQL-only (it explicitly targets MySQL ≥ 4.1 / PDO; SQLite support exists but is a side path) and PHP ≥ 5.3, so any modern Laravel version qualifies.
  • You need programmatic, filtered, transformed dumps — per-tenant exports, column redaction, per-table row limits — where the CLI binary would force you to generate shell commands and parse output.
  • You can't or don't want to guarantee a 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.
  • You need schema + routines + events + views + triggers in one artifact, including hex-encoded binary blobs (a genuine correctness win — escaped blobs are where naive dumpers corrupt data) and view dependency resolution via stand-in tables.
  • License posture is acceptable. This is GPL-3.0, not MIT. For a hosted SaaS where the code isn't distributed, this is typically fine. If you ship a distributed/commercial Laravel product (on-prem, downloadable, white-label), GPL-3.0 propagates to your distributed work — get legal sign-off before adoption, or isolate it so it isn't linked into distributed code. This is the single most important gating question and it is a product decision, not an engineering one.

Look elsewhere / push back

  • You need PostgreSQL, SQL Server, or multi-database support — wrong tool, full stop.
  • You need managed backups, PITR, or an RPO/RTO commitment — use the cloud provider's snapshotting; this package is not that.
  • You need incremental or CDC-style backups — not supported; every run is a full logical dump.
  • You need first-class Laravel packaging (service provider, 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.
  • Maturity/continuity risk is real and should be priced in. Signals: a single-maintainer project; the README's own admission that "current code for testing is an ugly hack"; a very low dependents count on the registry; documentation that is a CLI-flag reference rather than a guide; and a test suite whose core assertion is "output identical to 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.
  • Operational constraints to validate before committing: dumps of large tables are streamed to PHP and can hit memory/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.
  • The pdoSettings default of PDO::ATTR_PERSISTENT => true is worth an explicit override decision in a queue-worker context.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator
manelgavalda/enrollment_mobile
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics