I wrote this simple package, so I can swiftly dump my database whenever I need to. Also, in conjunction with Laravel 5 console commands, you can quickly setup a backup schedule. If you have the time, you can make your own implementation of PersistenceInterface, and save the dumps to S3/Google Drive/etc.
- php 5.5+
- mysqldump
composer require bancuadrian/mysqlbackupYou can use the BackupService class to quickly start dumping databases.
<?php
$backupStatus = \BancuAdrian\MysqlBackup\BackupService::backup('username','password',['database1','database2'],'/path/to/backup');
?>$backupStatus returns true if all are successful, or false otherwise.
After composer require, add this line to your config/app.php , providers section.
BancuAdrian\MysqlBackup\Support\ServiceProvider::classIf you want an alias, you can add this to the alias array
'BackupManager' => BancuAdrian\MysqlBackup\Support\Facade::classPublish the config file
php artisan vendor:publish --provider="BancuAdrian\MysqlBackup\Support\ServiceProvider"You can now find the config in config/mysqlbackup.php . Edit it to suite your needs.
You can then backup your databases using:
\BackupManager::backupAll();
// or for single database
\BackupManager::backup('databaseName');- Restore
- Backup to Google Drive
- Backup to S3
- Limit the number of backups in a folder
havefun() && contribute() && !criticize() && give_advice();