Backup and restore database support for Laravel 4 applications
-
Add the following to your composer.json and run
composer update{ "require": { "schickling/backup": "dev-master" } } -
Add
Schickling\Backup\BackupServiceProviderto your config/app.php
Creates a dump file in app/storage/dumps
$ php artisan db:backup$ php artisan db:backup --database=mysql$ php artisan db:backup --upload-s3 your-bucketUses the aws/aws-sdk-php-laravel package which needs to be configured.
Paths are relative to the app/storage/dumps folder.
$ php artisan db:restore dump.sql$ php artisan db:restoreYou can configure the package by adding a backup section in your app/config/database.php.
All settings are optional and have default values.
// ...
'default' => 'mysql',
/*
|--------------------------------------------------------------------------
| Backup settings
|--------------------------------------------------------------------------
|
*/
'backup' => array(
// add a backup folder in the app/database/ or your dump folder
'path' => app_path().'/database/backup/',
// add the path to the restore and backup command of mysql
// this exemple is if your are using MAMP server on a mac
'mysql' => array(
'dump_command_path' => '/Applications/MAMP/Library/bin/',
'restore_command_path' => '/Applications/MAMP/Library/bin/',
),
// s3 settings
's3' => array(
'path' => 'your/s3/dump/folder'
)
),
// ...You need to have mysqldump installed. It's usually already installed with MySQL itself.
db:restore WRONGFILENAMEmore detailed error messagedb:backup FILENAMEset title for dump- Compress dump files
- S3
- Upload as default
- default bucket
- More detailed folder checking (permission, existence, ...)
- Some more ideas? Tell me!



