PHPackages                             waheed43/googledrive-backup - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. waheed43/googledrive-backup

ActiveLibrary[Framework](/categories/framework)

waheed43/googledrive-backup
===========================

Laravel package for backing up and managing backups on Google Drive with Telegram notifications

v1.0.7(1y ago)091MITPHPPHP ^8.2

Since May 27Pushed 1y agoCompare

[ Source](https://github.com/AhmedWeb2022/backupPackage)[ Packagist](https://packagist.org/packages/waheed43/googledrive-backup)[ RSS](/packages/waheed43-googledrive-backup/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (16)Versions (9)Used By (1)

Here is a more professional, polished, and industry-standard version of your `README.md`, with enhanced formatting, clarity, and structure:

---

☁️ Laravel Backup to Google Drive
=================================

[](#️-laravel-backup-to-google-drive)

A Laravel-based system to automate application file and database backups, securely store them in Google Drive, and manage backup lifecycle efficiently using Laravel's task scheduler and custom Artisan commands.

---

🚀 Features
----------

[](#-features)

- **Automated Backups** – Powered by [Spatie Laravel Backup](https://github.com/spatie/laravel-backup) to back up files and databases.
- **Google Drive Integration** – Secure cloud storage via [Yaza Laravel Google Drive Storage](https://github.com/yaza-putu/laravel-google-drive-storage).
- **Scheduled Tasks** – Regular backups and cleanup via Laravel's task scheduler.
- **Backup Metadata** – Stores file links and project identifiers in a `backups` database table.
- **Custom Artisan Commands**:

    - `backup:store-link {project}` – Saves/updates the latest backup URL to the database.
    - `backup:delete-old-files` – Retains only the latest file on Google Drive.
- **Retention &amp; Cleanup Policy** – Automatically removes older backups based on defined rules.
- **Logging &amp; Monitoring** – Logs operations and errors for full observability.

---

🧰 Requirements
--------------

[](#-requirements)

- PHP ≥ 8.1
- Laravel ≥ 10
- Composer
- MySQL (or any supported DB)
- Google Drive API credentials:

    - Client ID &amp; Secret
    - Refresh Token
    - Folder ID

---

⚙️ Installation
---------------

[](#️-installation)

### 1. Clone &amp; Install Dependencies

[](#1-clone--install-dependencies)

```
git clone
cd
composer install
```

### 2. Required Packages

[](#2-required-packages)

```
"masbug/flysystem-google-drive-ext": "^2.4",
"spatie/laravel-backup": "^9.3",
"yaza/laravel-google-drive-storage": "^4.1",
"google/apiclient": "^2.15.0"
```

### 3. Set Environment Variables

[](#3-set-environment-variables)

Copy `.env.example` and configure the following:

```
GOOGLE_DRIVE_CLIENT_ID=your-client-id
GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret
GOOGLE_DRIVE_REFRESH_TOKEN=your-refresh-token
GOOGLE_DRIVE_FOLDER_ID=your-folder-id
GOOGLE_DRIVE_FOLDER=your-folder-name

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your-database
DB_USERNAME=your-username
DB_PASSWORD=your-password

APP_NAME=your-app-name
BACKUP_ARCHIVE_PASSWORD=your-optional-password

MAIL_FROM_ADDRESS=your-email@example.com
MAIL_FROM_NAME="Your App Name"
```

### 4. Google Drive API Setup

[](#4-google-drive-api-setup)

- Create a project in [Google Cloud Console](https://console.cloud.google.com/).
- Enable the **Google Drive API**.
- Generate OAuth 2.0 credentials.
- Obtain `Client ID`, `Client Secret`, `Refresh Token`, and `Folder ID`.

### 5. Database &amp; Storage Setup

[](#5-database--storage-setup)

```
php artisan migrate
php artisan storage:link
```

### 6. Configure Cron for Scheduler

[](#6-configure-cron-for-scheduler)

Add to your server's crontab:

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

---

🔧 Configuration
---------------

[](#-configuration)

### 📁 `config/backup.php`

[](#-configbackupphp)

- **Included paths**: Entire app directory (`base_path()`).
- **Excluded paths**: `vendor`, `node_modules`.
- **Database**: Uses `.env` DB config.
- **Destination**: Google Drive disk using ZIP format.
- **Cleanup Strategy**:

    - Keep all for 7 days.
    - Daily: 16 days
    - Weekly: 8 weeks
    - Monthly: 4 months
    - Yearly: 2 years
    - Limit: 5000 MB

### ☁️ `config/filesystems.php`

[](#️-configfilesystemsphp)

```
'google_drive' => [
    'driver' => 'google',
    'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
    'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
    'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
    'folder' => env('GOOGLE_DRIVE_FOLDER'),
    'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'),
],
```

---

📦 Usage
-------

[](#-usage)

### Manually Trigger Backup

[](#manually-trigger-backup)

```
php artisan backup:run
```

### Store/Update Latest Backup URL

[](#storeupdate-latest-backup-url)

```
php artisan backup:store-link sass
```

### Delete All But Latest Backup File

[](#delete-all-but-latest-backup-file)

```
php artisan backup:delete-old-files
```

### Clean Up Based on Retention Policy

[](#clean-up-based-on-retention-policy)

```
php artisan backup:clean
```

### Monitor Logs

[](#monitor-logs)

View logs in:

```
storage/logs/laravel.log

```

---

🗃️ Database Schema
------------------

[](#️-database-schema)

Table: `backups`

ColumnTypeDescriptionidBIGINTAuto-increment primary keyproject\_nameVARCHARName of the project (nullable)project\_slugVARCHARUnique slug for the projectfile\_linkTEXTBackup file URL on Google Drivecreated\_atTIMESTAMPRecord creation timeupdated\_atTIMESTAMPRecord last update time---

⏱️ Scheduled Tasks (`app/Console/Kernel.php`)
---------------------------------------------

[](#️-scheduled-tasks-appconsolekernelphp)

TaskDescription`backup:run`Generates a fresh backup`backup:clean`Cleans up old backups`backup:store-link sass`Stores the latest backup link`backup:delete-old-files`Deletes all but the latest backup---

🛠 Custom Components
-------------------

[](#-custom-components)

### `App\Services\GoogleDriveAdapter`

[](#appservicesgoogledriveadapter)

- Lists files from Google Drive.
- Gets the most recently uploaded file.
- Deletes all files except the newest.

### Artisan Commands

[](#artisan-commands)

- `StoreLatestBackupLink`: Fetches and stores latest backup link in DB.
- `DeleteOldBackupFiles`: Retains only the most recent file on Google Drive.

### Eloquent Model

[](#eloquent-model)

- `App\Models\Backup`

    - Fillable: `project_name`, `project_slug`, `file_link`

---

🧪 Troubleshooting
-----------------

[](#-troubleshooting)

IssueResolutionGoogle Drive API errorsVerify `.env` credentials and folder accessAdapter method not foundEnsure `GoogleDriveAdapter` includes all required methodsBackups not runningConfirm cron is active and points to correct Laravel pathStorage issuesValidate disk config in `config/filesystems.php`DebuggingCheck logs: `storage/logs/laravel.log`---

🤝 Contributing
--------------

[](#-contributing)

1. Fork the repo
2. Create a new branch (`git checkout -b feature/my-feature`)
3. Commit your changes (`git commit -m "Add feature"`)
4. Push to the branch (`git push origin feature/my-feature`)
5. Create a Pull Request

---

📄 License
---------

[](#-license)

This project is licensed under the [MIT License](LICENSE).

---

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- [Spatie Laravel Backup](https://github.com/spatie/laravel-backup)
- [Yaza Google Drive Storage](https://github.com/yaza-putu/laravel-google-drive-storage)
- [Google API Client](https://github.com/googleapis/google-api-php-client)

---

Would you like me to update this version into your current canvas now?

backupPackage
=============

[](#backuppackage)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

8

Last Release

402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/edfc332e309dc9b3dc3b613d66e2ae09f1a70d1867212d211a92da593ace0067?d=identicon)[AhmedWeb2022](/maintainers/AhmedWeb2022)

---

Top Contributors

[![AhmedWeb2022](https://avatars.githubusercontent.com/u/99670518?v=4)](https://github.com/AhmedWeb2022 "AhmedWeb2022 (29 commits)")

---

Tags

frameworklaravel

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/waheed43-googledrive-backup/health.svg)

```
[![Health](https://phpackages.com/badges/waheed43-googledrive-backup/health.svg)](https://phpackages.com/packages/waheed43-googledrive-backup)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

23.2k33.6k1](/packages/krayin-laravel-crm)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3891.8k](/packages/codewithdennis-larament)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

461.7k](/packages/ercogx-laravel-filament-starter-kit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
