Weave Code
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

Db Dumper Laravel Package

spatie/db-dumper

PHP database dump utility supporting MySQL, MariaDB, PostgreSQL, SQLite, and MongoDB. Wraps native tools (mysqldump, mariadb-dump, pg_dump, sqlite3, mongodump) with a simple fluent API to export databases to SQL or gz files.

View on GitHub
Deep Wiki
Context7

Dump the contents of a database

Frequently asked questions about Db Dumper
How do I install Spatie DB Dumper in a Laravel project?
Run `composer require spatie/db-dumper` in your project directory. The package supports Laravel 8+ and requires PHP 8.0+. No additional configuration is needed unless you want to bind it to the service container.
Can I dump a MySQL database directly from Laravel without CLI tools?
No, Spatie DB Dumper relies on system tools like `mysqldump`. If these aren’t available (e.g., in Docker or CI/CD), you’ll need to install them manually or use a PDO-based fallback, though performance may degrade.
Does this package support automated database backups via Laravel Scheduler?
Yes, you can schedule dumps using Laravel’s scheduler. Register the `db:dump` Artisan command in your `app/Console/Kernel.php` and call it with `$schedule->command('db:dump')->daily()`.
How do I customize the output path or filename for database dumps?
Use the fluent API to specify the path. For example, `MySql::create()->dumpToFile(storage_path('app/dumps/backup_' . now()->format('Y-m-d') . '.sql'))` writes to a custom location.
Is there a way to compress MongoDB dumps automatically?
Yes, MongoDB dumps default to `.gz` format. For other databases, append `.gz` to the filename or use `->compress()` if supported (though this may require custom logic).
Will this work in a multi-tenant Laravel app (e.g., Stancl/Tenant)?
No, the package doesn’t natively support multi-tenancy. You’ll need to loop through tenants manually or extend the dumper to filter by tenant ID, then merge results.
Are credentials stored securely in production?
Credentials are passed as plaintext unless you use Laravel’s `.env` or encryption. Always avoid hardcoding sensitive data; rely on Laravel’s configuration system or environment variables.
Can I dump multiple databases at once with this package?
Not natively. You’d need to chain multiple dumper instances or write a custom wrapper to iterate over databases defined in `config/database.php`.
How do I handle large databases that exceed memory limits?
For large databases, use chunked dumps or stream output directly to a file. The package doesn’t natively support chunking, but you can extend it or use system tools like `mysqldump --quick`.
Are there alternatives to Spatie DB Dumper for Laravel?
Yes, alternatives include Laravel’s built-in `Schema::dump()` (for migrations), `laravel-backup` (for cloud storage), or `doctrine/dbal` for PDO-based dumps. Spatie’s package excels for raw, tool-based exports with a simple API.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai