greathimansh/backup-auto-detect-database 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

greathimansh/backup-auto-detect-database

Composer 安装命令:

composer require greathimansh/backup-auto-detect-database

包简介

Backup MySQL and MongoDB databases and upload to Google Drive automatically.

README 文档

README

Automatically backup MySQL or MongoDB databases and upload them to Google Drive, as a reusable Laravel package.

👑 Package by: greatHimanshu

🚀 Features

  • 🔐 Secure upload to Google Drive using a Service Account
  • 💾 Auto-detect MySQL or MongoDB and perform dump
  • ☁️ Upload .sql or .archive file to Drive
  • 🧹 Auto-delete local files after upload
  • 🔄 Ready for Laravel scheduler integration
  • 🧩 Easy to install and use

📥 Installation

1. Require the package via Composer

composer require greathimansh/backup-auto-detect-database

⚙️ Laravel Usage

1. Publish config (optional)

php artisan vendor:publish --tag=backup-auto-detect-config

This will publish a config file: config/backup-auto-detect.php

2. Add Service Account JSON file

Place your Google Drive service account key file here:

storage/app/google/service-account.json

🛠 Configuration (.env)

Add these entries:

GOOGLE_DRIVE_FOLDER_ID=your_drive_folder_id_here        # ✅ Required — Google Drive folder ID
DB_BACKUP_TYPE=mysql                                     # ✅ Required — mysql or mongodb

MYSQLDUMP_PATH=your_mysql_dump_path_here                 # 🔁 Optional — full path if mysqldump is not in system PATH
MONGODUMP_PATH=your_mongodb_dump_path_here               # 🔁 Optional — full path if mongodump is not in system PATH

BACKUP_REPLACE=true                                      # 🔁 Optional — if true, will delete old backup before uploading new

▶️ Run the Command

Use the built-in Artisan command:

php artisan backup:auto-upload

Example output:

Starting database backup...
Detected: MySQL
Dumping all databases...
Uploading to Google Drive...
✅ Upload complete. Local file deleted.

🔁 Automate with Laravel Scheduler

In app/Console/Kernel.php:

$schedule->command('backup:auto-upload')->dailyAt('02:00');

Run scheduler every minute via cron (Linux):

* * * * * cd /path-to-project && php artisan schedule:run >> /dev/null 2>&1

On Windows, use Task Scheduler.

🧩 Supported Versions

  • PHP 8.1+
  • Laravel 9, 10, 11, 12
  • MySQL via mysqldump
  • MongoDB via mongodump

Ensure mysqldump or mongodump is available in system PATH or provide full path in the config.

📂 Where does it store backups?

  • Files are uploaded to your Google Drive folder
  • Filename format: all-databases-backup.sql or .archive (MongoDB)

🧑‍💻 Contributing

PRs are welcome. Make sure your code is clean, PSR-4 compliant, and properly documented.

👨‍🎓 Author

greatHimanshu
🔗 GitHub

🛡 License

This package is licensed under the MIT License.

greathimansh/backup-auto-detect-database 适用场景与选型建议

greathimansh/backup-auto-detect-database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 06 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 greathimansh/backup-auto-detect-database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 greathimansh/backup-auto-detect-database 我们能提供哪些服务?
定制开发 / 二次开发

基于 greathimansh/backup-auto-detect-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-08