Download the PHP package kwenziwa/database-backup without Composer
On this page you can find all versions of the php package kwenziwa/database-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kwenziwa/database-backup
More information about kwenziwa/database-backup
Files in kwenziwa/database-backup
Package database-backup
Short Description A Laravel package to backup the database and upload to Google Drive.
License MIT
Informations about the package database-backup
π¦ kwenziwa/database-backup
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:
βοΈ Configuration
Step 1: Publish 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).
- Name: e.g.,
- 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
- Visit the Google Drive API page and click Enable.
- For detailed step-by-step instructions, see this guide:
How to Enable Google Drive API on the Google Console
3οΈβ£ Save the Credentials File
Move the downloaded JSON key file to:
Ensure the path matches this in your .env
:
π 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:
The folder ID is:
Add this to your .env
:
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
π Usage
Backup your database and upload to Google Drive:
Test Google Drive connection:
π Requirements
- PHP 8.2+
- Laravel 10, 11, or 12
- Spatie Laravel Backup v9.2.8+
- Google API Client
π 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