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 ideal for Laravel applications already using that package for database backups. It extends the backup workflow by enabling restore operations without reinventing the wheel.config/backup.php), and dependency injection, ensuring seamless adoption in existing Laravel stacks.spatie/laravel-backup setup (backward compatibility with v10+).config/backup.php.spatie/laravel-backup (v10+) for backup files, encryption keys, and storage configurations.--set-gtid-purged=OFF)..env or secrets manager).MyCustomHealthCheck example)..env)?--keep flag)?--no-interaction suffice for automation?spatie/laravel-backup (v10+).config/backup.php (local, S3, FTP, etc.).spatie/laravel-backup is installed and configured (config/backup.php).composer require wnx/laravel-backup-restore
php artisan vendor:publish --tag="backup-restore-config"
config/laravel-backup-restore.php (health checks, defaults).config/backup.php aligns with restore needs (e.g., GTID settings).php artisan backup:restore --help to validate CLI options.--keep to inspect files.spatie/laravel-backup v10+ (tested up to v10.x).pg_dump/pg_restore compatibility.--reset) or compatible.--keep to inspect downloaded/decrypted files before restoring.--no-interaction for CI/CD or cronjobs.--keep was used).wnx/laravel-backup-restore and spatie/laravel-backup updates.config/backup.php and config/laravel-backup-restore.php.pdo_mysql, pdo_pgsql) are installed on all environments.--set-gtid-purged=OFF to config/backup.php.config/backup.php.Result::failed() messages.APP_DEBUG=true) for detailed error output.--reset to avoid conflicts with existing data.--keep cautiously).APP_NAME and config/backup.php are consistent across environments (backups are named by APP_NAME).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Corrupted Backup File | Restore fails | Use GitHub Actions workflow to validate backups regularly. |
| GTID Conflict (MySQL) | Restore blocks | Configure --set-gtid-purged=OFF in config/backup.php. |
| Incorrect Encryption Password | Decryption fails | Store passwords in secrets manager; use --password flag carefully. |
| Health Check Fails | Restore marked as failed | Review custom health checks; add logging to debug failures. |
| Disk Permissions Issues | Backup files inaccessible | Ensure storage disks (e.g., S3) have proper IAM roles/permissions. |
| Database Connection Errors | Restore |
How can I help you explore Laravel packages today?