scryba / laravel-backup-complete-restore
Complete backup restoration for Spatie Laravel Backup - restores both database and files to their exact locations with consolidated configuration and internal health checks
Fund package maintenance!
michael.laweitech.com/buy-me-a-coffee
Requires
- php: ^8.1|^8.2|^8.3|^8.4
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/filesystem: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- spatie/laravel-backup: ^8.0|^9.0
- wnx/laravel-backup-restore: ^1.6
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
README
A comprehensive Laravel package for complete backup restoration, including both database and file restoration from Spatie Laravel Backup archives with consolidated configuration and internal health checks.
✨ Features
- 🔄 Complete Restoration: Restore both database and files from Spatie Laravel Backup archives
- 🎯 Consolidated Configuration: Single configuration file that leverages existing Laravel config
- 🛡️ Internal Health Checks: Self-contained health check classes extending dependency packages
- 🔧 Config System Integration: Automatic compatibility with
wnx/laravel-backup-restore
- 📁 Smart File Mappings: Intelligent mapping of container paths to local filesystem
- 🚀 Multiple Storage Support: Works with local, S3, Google Drive, and other storage disks
- 🔒 Safety Features: Backup existing files, confirmation prompts, and error handling
- 📊 Progress Tracking: Real-time progress indicators and detailed logging
- 🎨 Beautiful CLI: Colorful, emoji-rich command-line interface
🚀 Quick Start
Installation
composer require scryba/laravel-backup-complete-restore
Basic Usage
# List available backups php artisan backup:restore-complete --list # Restore complete backup (interactive) php artisan backup:restore-complete # Restore specific backup php artisan backup:restore-complete --backup="2024-01-15-10-30-00.zip" # Restore database only php artisan backup:restore-complete --database-only # Restore files only php artisan backup:restore-complete --files-only
📋 Prerequisites
This package requires Spatie Laravel Backup to be installed and configured in your application.
Required Dependencies
- PHP: 8.1 or higher
- Laravel: 10.0, 11.0, or 12.0
- Spatie Laravel Backup: 8.0 or higher
- WNX Laravel Backup Restore: 1.6 or higher
📚 Documentation
Getting Started
- 📖 Installation Guide - Complete setup and configuration
- ⚙️ Configuration Guide - Package configuration options
- 🔧 Commands Guide - Available Artisan commands and options
Advanced Usage
- 🛡️ Health Checks - Built-in and custom health checks
- 📁 File Mappings - Understanding and configuring file mappings
- 🔍 Troubleshooting - Common issues and solutions
🎯 Key Benefits
Consolidated Configuration
Instead of multiple configuration files, this package uses a single config/backup-complete-restore.php
file that leverages your existing Laravel configuration (config/database.php
, config/filesystems.php
, config/backup.php
).
Internal Health Checks
Self-contained health check classes that extend dependency packages, making the package more maintainable and reducing direct external dependencies.
Seamless Integration
Automatic compatibility with wnx/laravel-backup-restore
through config system integration - no physical files needed.
🔧 Configuration
The package automatically registers its configuration. To customize settings:
php artisan vendor:publish --provider="Scryba\LaravelBackupCompleteRestore\BackupCompleteRestoreServiceProvider"
Basic Configuration
// config/backup-complete-restore.php return [ 'file_mappings' => [ 'var/www/html/storage/app/public' => storage_path('app/public'), 'var/www/html/public' => public_path(), 'var/www/html/app' => base_path('app'), ], 'health_checks' => [ \Scryba\LaravelBackupCompleteRestore\HealthChecks\Checks\DatabaseHasTables::class, \Scryba\LaravelBackupCompleteRestore\HealthChecks\Checks\FilesExist::class => [ 'files' => [ storage_path('app/public'), storage_path('logs'), ], ], ], ];
🛠️ Available Commands
Command | Description |
---|---|
backup:restore-complete |
Complete backup restoration (database + files) |
backup:health-check |
Run health checks on restored backup |
scryba:backup-health-check |
Run custom health checks |
Command Options
# List backups php artisan backup:restore-complete --list # Selective restoration php artisan backup:restore-complete --database-only php artisan backup:restore-complete --files-only # Backup selection php artisan backup:restore-complete --backup="filename.zip" php artisan backup:restore-complete --disk="s3" # Database options php artisan backup:restore-complete --connection="mysql" php artisan backup:restore-complete --reset # Safety options php artisan backup:restore-complete --force php artisan backup:restore-complete --verbose
🔄 Integration with Spatie Laravel Backup
This package is designed to work seamlessly with Spatie Laravel Backup:
- Spatie creates backups → This package restores them
- Same configuration → Uses your existing Spatie backup configuration
- Same storage disks → Works with all configured storage disks
- Same file structure → Understands Spatie's backup archive format
🎨 Example Output
📋 Available Backups
Disk: local
├── 2024-01-15-10-30-00.zip (15.2 MB)
├── 2024-01-15-09-15-00.zip (14.8 MB)
└── 2024-01-14-23-45-00.zip (14.9 MB)
🔄 Starting complete restoration...
📦 Extracting backup archive...
[████████████████████] 100%
🗄️ Restoring database...
[████████████████████] 100%
📁 Restoring files...
[████████████████████] 100%
✅ Restoration completed successfully!
🔍 Running health checks...
✅ Database has tables
✅ Critical files exist
✅ File integrity verified
🎉 Complete restoration finished successfully!
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
📄 License
The MIT License (MIT). Please see License File for more information.
🙏 Acknowledgments
- Spatie for the excellent Laravel Backup package
- WNX for the Laravel Backup Restore package
- The Laravel community for inspiration and support
📞 Support
- 📧 Email: contact@michael.laweitech.com
- 🌐 Website: https://michael.laweitech.com/
- ☕ Buy me a coffee: https://michael.laweitech.com/buy-me-a-coffee
- 🐛 Issues: GitHub Issues
Made with ❤️ by Michael K. Laweh