wnx/laravel-backup-restore
Restore database backups created by spatie/laravel-backup. Adds an interactive php artisan backup:restore command to pick a backup and optionally decrypt it, then run configurable post-restore health checks to validate the restored DB.
spatie/laravel-backup, making it a natural fit for Laravel applications already using that package for database backups. It extends the backup workflow by enabling restoration, closing a critical gap in the backup lifecycle.config/backup.php for disk, encryption, and connection settings.spatie/laravel-backup (v9+) means the package is useless without it. This is a blocker if the app doesn’t use Spatie’s backup.backup:restore command follows Laravel’s CLI patterns, making it familiar to developers.--set-gtid-purged=OFF).config/backup.php for decryption keys. Key management becomes critical (e.g., secrets in CI/CD, environment variables).spatie/laravel-backup (v9+) for DB backups? If not, this package is incompatible.--no-interaction flag is critical for automation.APP_NAME and config/backup.php configured per environment (e.g., staging vs. production)?spatie/laravel-backup (v9+). No alternative backup formats supported.config/backup.php (local, S3, FTP, etc.).spatie/laravel-backup (v9+) is installed and configured.composer require wnx/laravel-backup-restore
php artisan vendor:publish --tag="backup-restore-config"
config/backup.php has correct disks, sources, and encryption settings.APP_NAME matches the backup folder naming convention.php artisan backup:restore --dry-run (if supported) or test in a staging environment.spatie/laravel-backup. Incompatible with raw SQL dumps or other tools..sql, .sql.gz, and .sql.bz2 (added in v1.2.0). Older backups may fail if uncompressed.--reset flag).--backup=latest for simplicity or specify a path (e.g., --backup=backups/production/2024-05-01.sql.gz).--no-interaction and all required flags (disk, connection, password).--keep flag for debugging).wnx/laravel-backup-restore and spatie/laravel-backup for breaking changes (e.g., Laravel 13 support).config/backup.php and config/laravel-backup-restore.php must stay in sync across environments.APP_NAME must match backup folder naming conventions.NoDatabaseDumpsFound: Verify --disk and backup paths.--set-gtid-purged=OFF to backup config.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Corrupted backup file | Restore fails silently or partially | Validate backups with spatie/laravel-backup:verify or GitHub Actions workflow. |
| Incorrect decryption key | Backup decryption fails | Use --password flag or ensure config/backup.php keys are correct. |
| GTID/replication conflicts | MySQL restore fails | Pre-backup: Add --set-gtid-purged=OFF to config/backup.php. |
| Disk permissions denied | Backup download fails | Verify IAM roles (S3), filesystem permissions (local), or credentials. |
| Schema drift (backup vs. target DB) | SQL syntax errors | Test restores in staging; use --reset to wipe target DB first. |
| Health check failures | Restore marked as failed | Review custom health checks; ensure they’re non-destructive. |
How can I help you explore Laravel packages today?