Full, Incremental & Differential Backups for Laravel — includes multi-database support, scheduling, cloud upload, and restore-from-cloud.
- Copy this package into your project's
vendor/
folder (e.g.vendor/gokulsingh/laravel-incremental-backup
) OR add it as a path repository in your main composer.json:
"repositories": [
{
"type": "path",
"url": "vendor/gokulsingh/laravel-incremental-backup"
}
]
- Require it via composer:
composer require gokulsingh/laravel-incremental-backup:dev-main
- Publish config and run migrations:
php artisan vendor:publish --provider="Gokulsingh\\IncrementalBackup\\IncrementalBackupServiceProvider"
php artisan migrate
- Configure
.env
:
BACKUP_DISK=local
BACKUP_PATH=backups
BACKUP_CLOUD_ENABLED=true
BACKUP_CLOUD_DISK=s3
BACKUP_CLOUD_PATH=cloud_backups
# Optional: schedule defaults
BACKUP_SCHEDULE_ENABLED=true
BACKUP_SCHEDULE_FREQUENCY=daily
BACKUP_SCHEDULE_TYPE=full
BACKUP_SCHEDULE_CONNECTION=mysql
BACKUP_SCHEDULE_DBNAME=null
php artisan backup:run --type=full --connection=mysql
php artisan backup:run --type=incremental --connection=mysql
php artisan backup:run --type=differential --connection=mysql
php artisan backup:run --type=full --connection=mysql --dbname=customer_db
php artisan backup:list
php artisan backup:restore 1 --connection=mysql --dbname=customer_db
-
MySQL binary logging must be enabled for incremental backups: Add to my.cnf:
[mysqld] server-id=1 log-bin=mysql-bin binlog_format=ROW
Restart MySQL after changes.
-
Differential backups in this MVP use
updated_at
filtering where possible. This is a heuristic; for robust differential backups consider triggers, change tables, or CDC. -
Cloud upload uses Laravel filesystem disks. Configure S3/Dropbox/etc in
config/filesystems.php
and setBACKUP_CLOUD_DISK
accordingly. -
The package uses system commands (
mysqldump
,mysql
,mysqlbinlog
,gzip
,gunzip
). Ensure they are available in PATH or override the commands inconfig/incremental-backup.php
.
- Improve binlog delta handling (store exact positions, incremental chains)
- Add optional encryption
- Add backup retention & cleanup
- Add UI dashboard & manual restore from UI
- Add notifications (Slack, email)
MIT