gokulsingh/laravel-incremental-backup
最新稳定版本:v1.0.0
Composer 安装命令:
composer require gokulsingh/laravel-incremental-backup
包简介
Laravel package for full, incremental, and differential database backups with scheduling and cloud upload.
README 文档
README
Full, Incremental & Differential Backups for Laravel — includes multi-database support, scheduling, cloud upload, and restore-from-cloud.
Installation
- 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
Usage
Run a full backup
php artisan backup:run --type=full --connection=mysql
Run an incremental backup (mysql binlog required)
php artisan backup:run --type=incremental --connection=mysql
Run a differential backup (since last full)
php artisan backup:run --type=differential --connection=mysql
Override database name
php artisan backup:run --type=full --connection=mysql --dbname=customer_db
List backups
php artisan backup:list
Restore a backup by ID
php artisan backup:restore 1 --connection=mysql --dbname=customer_db
Notes & Requirements
-
MySQL binary logging must be enabled for incremental backups: Add to my.cnf:
[mysqld] server-id=1 log-bin=mysql-bin binlog_format=ROWRestart MySQL after changes.
-
Differential backups in this MVP use
updated_atfiltering 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.phpand setBACKUP_CLOUD_DISKaccordingly. -
The package uses system commands (
mysqldump,mysql,mysqlbinlog,gzip,gunzip). Ensure they are available in PATH or override the commands inconfig/incremental-backup.php.
Roadmap
- 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)
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-05