Download the PHP package jpbgomes/laravel-database-backup without Composer
On this page you can find all versions of the php package jpbgomes/laravel-database-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jpbgomes/laravel-database-backup
More information about jpbgomes/laravel-database-backup
Files in jpbgomes/laravel-database-backup
Package laravel-database-backup
Short Description A simple Laravel package to backup MySQL databases and send them via email.
License MIT
Informations about the package laravel-database-backup
Laravel Database Backup
A simple Laravel package to back up your MySQL or MariaDB database and send the backup file via email, now with optional ZIP compression, password protection, and extra file/folder inclusion.
⚠️ Only MySQL/MariaDB are supported currently, since the package relies on
mysqldump.
🚀 Installation
Require the package via Composer (from Packagist):
Laravel will auto-discover the service provider. If not, add it manually to config/app.php:
Publish the config file:
⚙️ Configuration
Edit config/backup.php after publishing:
Set your backup recipients and optional ZIP password in .env:
Mailer Configuration
You must configure Laravel’s mailer to send the backups. A free recommended option is Gmail, but you must enable 2-Factor Authentication and create an App Password.
Example .env:
📝 Usage
Run the backup command:
This will:
- Create a
.sqldump usingmysqldump. - Generate a
.zipfile containing the SQL dump. -
Optionally:
- Protect the zip with a password.
- Include extra folders/files in the zip.
- Send the ZIP file to all configured recipients.
- Optionally remove the local ZIP file.
⚙️ Advanced Configuration
Multiple Recipients
Password Protect ZIP
If empty, the ZIP will not be encrypted.
Include Additional Files/Folders
Edit config/backup.php:
Paths are relative to base_path().
⏰ Automating Daily Backups
You can automate backups using crontab. Example to run every day at 4 AM:
Adjust the path to your Laravel project’s
artisanfile.
🛡 Security Notes & Caveats
mysqldumpmust be installed and accessible to the PHP process user.- DB credentials may appear briefly in process listings.
- For large databases, the backup is compressed in a ZIP.
- SQL file is never sent directly, reducing exposure.
- Password-protected ZIP uses AES-256 encryption.
🤝 Contributing & Improvements
Suggestions for improvements:
- Support for other database types (Postgres, SQLite).
- Remote storage integrations (S3, Google Cloud, etc.).
- Unit and integration tests for the backup command.
- CI/CD pipeline for testing and releases.
📜 License
MIT — free to use, modify, and share.