juice / backups
Backup database and application.
Requires
- php: ^7.2
- ext-zlib: *
- illuminate/console: ~5.7|~6.0|~7.0|~8.0
- illuminate/support: ~5.7|~6.0|~7.0|~8.0
- nesbot/carbon: ~1.36|~2.0
- spatie/db-dumper: ~2.11
- symfony/finder: ~4.1|~5.0
- symfony/process: ~4.1|~5.0
Requires (Dev)
- orchestra/testbench: ~3.7|~4.0|~5.0
- phpunit/phpunit: ~7.4|~8.0|~9.0
README
Backup your application and database data to local filesystem.
Note
This package use spatie/db-dumper to dump database data. For supporting database type, please check here and make sure meets the requirement.
Installation
-
run composer require command
composer require juice/backups
-
register
\Juice\Backups\BackupsServiceProvider::class
service provider -
copy config file and set it up
-
Laravel -
php artisan vendor:publish --provider="Juice\Backups\BackupsServiceProvider"
-
Lumen -
cp vendor/juice/backups/config/juice-backups.php config/
(make sure config directory exist)
-
-
run setup command
php artisan backup:setup
-
done
Commands
- backup:setup - initialize package
- backup:run - backup application and database
- backup:cleanup - cleanup outdated backups
Usage
All you need to do is add run
and cleanup
command to schedule method.
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('backup:run')->hourly(); $schedule->command('backup:cleanup')->dailyAt('01:30'); }
You can find more schedule information here.
Backup Mechanism
- hourly backups for the past 24 hours
- daily backups for the past month
- weekly backups for all previous months