Simple Laravel Database Backup Solution
composer require basry/larabackup
After updating composer, add the ServiceProvider to the providers array in config/app.php
Basry\Larabackup\LarabackupServiceProvider::class,
Using Facade
use Basry\Larabackup\Facades\Larabackup;
Larabackup::backup(); // Auto Naming
Or
Larabackup::backup($dumpName);
Larabackup::restore($dumpFullName);
You can backup, restore, and list database dumps using cli.
php artisan larabackup:backup
php artisan larabackup:restore dumpFullName
php artisan larabackup:list
You can publish config files if you need to change the defaults
php artisan vendor:publish --tag=larabackup-config
'disk' => 'local', // Storage Disk To use
'path' => 'database/dumps', // Path To save and restore dumps
You can override any of the default configs
Larabackup::connection($connection)->backup();
php artisan larabackup:backup --database=DatabaseConnection
Larabackup::disk($disk)->restore($backupName);
php artisan larabackup:backup --disk=Disk
Larabackup::path($path)->backup();
php artisan larabackup:backup --path=Path
Larabackup is open-sourced software licensed under the MIT license.