承接 kwenziwa/database-backup 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kwenziwa/database-backup

最新稳定版本:1.0.0

Composer 安装命令:

composer require kwenziwa/database-backup

包简介

A Laravel package to backup the database and upload to Google Drive.

README 文档

README

A Laravel package to automate database backups and upload them to Google Drive.
Seamlessly integrates with Spatie's Laravel Backup and the Google API client.
Ideal for keeping your backups safe and accessible in the cloud.

🚀 Features

  • 🎯 Backup your database with Spatie’s Laravel Backup
  • ☁️ Upload the latest backup automatically to Google Drive
  • 🔒 Fully Laravel 12+ compatible
  • 🔧 Easy configuration and installation

📥 Installation

Install the package via Composer:

composer require kwenziwa/database-backup

⚙️ Configuration

Step 1: Publish Config

php artisan vendor:publish --tag=config

Creates config/database-backup.php.

🔑 Google API Setup

1️⃣ Create Google API Credentials

  • Go to the Google Cloud Console.
  • Navigate to Service Accounts.
  • Click Create Service Account.
  • Follow the prompts:
    • Name: e.g., Database Backup Service
    • Role: Choose Editor (or more restricted if desired).
  • After creating the service account:
    • Go to the Keys tab.
    • Click Add Key → Create New Key → JSON.
    • Download the JSON key file.

2️⃣ Enable Google Drive API

3️⃣ Save the Credentials File

Move the downloaded JSON key file to:

storage/app/google-drive/credentials.json

Ensure the path matches this in your .env:

GOOGLE_DRIVE_CREDENTIALS=storage/app/google-drive/credentials.json

📁 Set Up Google Drive Access

4️⃣ Get Your Google Drive Folder ID

  • Create a folder in Google Drive (e.g., Database Backups).

  • Right-click the folder → Get Link → Copy the long ID in the URL:

    Example:

    https://drive.google.com/drive/folders/1a2B3cD4EfG5hI6Jk7LmNOPQr8TuvWXy
    

    The folder ID is:

    1a2B3cD4EfG5hI6Jk7LmNOPQr8TuvWXy
    

Add this to your .env:

GOOGLE_DRIVE_FOLDER_ID=1a2B3cD4EfG5hI6Jk7LmNOPQr8TuvWXy

5️⃣ Share Folder with Service Account

  • Open your Google Drive folder.
  • Click Share.
  • In the People field, paste the client_email from your JSON file (example below).
  • Give Editor access.

🔍 Example credentials.json Structure

{
  "type": "service_account",
  "project_id": "your-project-id",
  "private_key_id": "your-private-key-id",
  "private_key": "-----BEGIN PRIVATE KEY-----\nABC...\n-----END PRIVATE KEY-----\n",
  "client_email": "database-backup@your-project.iam.gserviceaccount.com",
  "client_id": "1234567890",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/database-backup%40your-project.iam.gserviceaccount.com"
}

🚀 Usage

Backup your database and upload to Google Drive:

php artisan google-drive:backup

Test Google Drive connection:

php artisan google-drive:test

🌍 Requirements

📖 Documentation

Command Description
php artisan google-drive:backup Backup database and upload to Google Drive
php artisan google-drive:test Test Google Drive connection and credentials
php artisan vendor:publish --tag=config Publish the package config file

🙌 Author

Developed by Kwenziwa Khanyile
Feel free to contribute, submit issues, or fork the repository!

📄 License

MIT © 2024 Kwenziwa Khanyile

kwenziwa/database-backup 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-24