arpanpatoliya/db-backup
最新稳定版本:v1.2.2
Composer 安装命令:
composer require arpanpatoliya/db-backup
包简介
A Laravel package for database backup with Google Drive integration
README 文档
README
A Laravel package to automate your database backups and upload them directly to Google Drive.
✨ Features
- Easily back up your Laravel application's database
- Automatically upload backups to Google Drive
- Run backups via artisan commands
- Configure automatic cleanup of old backups
📦 Installation
Install the package via Composer:
composer require arpanpatoliya/db-backup
⚙️ Configuration
After installation, publish the configuration file:
php artisan vendor:publish --provider="Arpanpatoliya\DBBackup\DBBackupServiceProvider"
This will create a config file at:
config/dbbackup.php
Update your .env file with the following values:
# Local backup path (customize if needed) DBBACKUP_LOCAL_PATH=/full/custom/path/if/needed # Optional: Maximum number of backups to retain (default: 5) DBBACKUP_MAX_STORED=5 # Database connection (should match config/database.php) DB_CONNECTION=mysql # Google Drive API credentials GOOGLE_DRIVE_CLIENT_ID=your-client-id GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret GOOGLE_DRIVE_ACCESS_TOKEN=your-access-token GOOGLE_DRIVE_REFRESH_TOKEN=your-refresh-token # Google Drive folder ID to store backups GOOGLE_DRIVE_FOLDER=your-google-drive-folder-id
🚀 Usage
Run Backup Programmatically
You can trigger a backup directly in your code:
use Arpanpatoliya\DbBackup\Backup;
public function triggerBackupDirectly()
{
$backup = new Backup();
$success = $backup->run();
$success = json_decode($success, true);
return response()->json($success);
}
Run Backup via Artisan Command
Useful for cron jobs or scheduled tasks:
php artisan db-backup:run
✅ Testing
To run the tests:
composer test
👨💻 Credits
- Arpan Patoliya - Project creator and maintainer
📄 License
MIT License. See LICENSE for details.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-17