PHPackages                             ahmedweb/laravel-backup-service - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ahmedweb/laravel-backup-service

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ahmedweb/laravel-backup-service
===============================

A simple Laravel package to make backup services easier to implement using traits.

v1.0.3(1y ago)05MITPHPPHP ^8.2

Since Jun 1Pushed 1y agoCompare

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

READMEChangelogDependencies (9)Versions (5)Used By (0)

Laravel Backup Service
======================

[](#laravel-backup-service)

[![Latest Version on Packagist](https://camo.githubusercontent.com/11707aa5da93e989c352fc19f16fc71d9f9bdc862859809e679cd0cce81eee33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d65647765622f6c61726176656c2d6261636b75702d736572766963652e737667)](https://packagist.org/packages/ahmedweb/laravel-backup-service)[![License: MIT](https://camo.githubusercontent.com/aeeb6fb1eba822e89981a3d388e1e4c0b082cc092d45cf9b2830aef5f2a211e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61686d65647765622f6c61726176656c2d6261636b75702d736572766963652e737667)](LICENSE.md)

**Laravel Backup Service** is a powerful and developer-friendly package designed to automate your Laravel application backups. It seamlessly integrates with **Google Drive** and **Telegram**, offering convenient backup uploads, link notifications, and scheduled cleanup – all through simple Artisan commands.

---

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

[](#-features)

- 📁 Backup uploads directly to **Google Drive**
- 🔗 Auto-send backup download links to **Telegram**
- 📌 Store and manage latest backup file links
- 🧹 Automatically delete outdated backup files
- ✅ Clean, modular, and maintainable code structure
- 💻 Easy-to-use Artisan commands
- 🕐 Fully schedulable via Laravel Scheduler

---

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require ahmedweb/laravel-backup-service
```

Publish the configuration and service provider:

```
php artisan vendor:publish --tag=laravel-backup-service
```

---

⚙️ Configuration
----------------

[](#️-configuration)

### 1. Environment Setup

[](#1-environment-setup)

Add the following variables to your `.env` file:

```
FILESYSTEM_CLOUD=google

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
# Optional custom folder name
GOOGLE_DRIVE_FOLDER=

TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id
```

---

### 2. Filesystem Configuration

[](#2-filesystem-configuration)

Update `config/filesystems.php` with a new `google_drive` disk:

```
'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'),
],
```

---

💬 Telegram Integration
----------------------

[](#-telegram-integration)

### Step 1: Create a Telegram Bot

[](#step-1-create-a-telegram-bot)

1. Open Telegram and search for `@BotFather`.
2. Use `/newbot` and follow the prompts to create a bot.
3. Copy the provided token and paste it into your `.env` as `TELEGRAM_BOT_TOKEN`.

### Step 2: Add Bot to a Group

[](#step-2-add-bot-to-a-group)

1. Create a group or use an existing one.
2. Add your bot to the group.
3. Mention the bot once to activate it.

### Step 3: Get Group Chat ID

[](#step-3-get-group-chat-id)

- Use `@userinfobot` or check the `chat.id` field via bot API messages.
- Paste the group chat ID into your `.env` as `TELEGRAM_CHAT_ID`.

---

⚙️ Laravel 11 Integration
-------------------------

[](#️-laravel-11-integration)

### Register Storage Provider

[](#register-storage-provider)

In `bootstrap/app.php`, register the Google Drive provider:

```
use AhmedWeb\LaravelBackupService\Providers\GoogleDriveStorageProvider;

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders([
        GoogleDriveStorageProvider::class,
    ])
    ->create();
```

---

⏰ Scheduling Backups (Optional)
-------------------------------

[](#-scheduling-backups-optional)

In `bootstrap/app.php`, add scheduled commands:

```
use Illuminate\Console\Scheduling\Schedule;

return Application::configure(basePath: dirname(__DIR__))
    ->withSchedule(function (Schedule $schedule) {
        $schedule->command('backup:run')->daily();
        $schedule->command('backup:clean')->daily();
        $schedule->command('backup:store-latest-link')->dailyAt('01:00');
        $schedule->command('backup:delete-old')->weekly();
    })
    ->create();
```

Ensure Laravel Scheduler is set in your server cron:

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

---

🧪 Available Artisan Commands
----------------------------

[](#-available-artisan-commands)

CommandDescription`backup:store-latest-link`Stores and sends the latest backup download link via Telegram`backup:delete-old`Deletes outdated backup files from Google Drive`backup:clean-drive`Cleans up Google Drive backups according to retention rules> For Laravel 10 or below, schedule commands in `app/Console/Kernel.php`.

---

📁 File Structure
----------------

[](#-file-structure)

```
laravel-backup-service/
├── src/
│   ├── Commands/
│   │   ├── StoreLatestBackupLink.php
│   │   ├── DeleteOldBackupFiles.php
│   │   └── CleanGoogleDriveBackups.php
│   ├── Services/
│   │   └── GoogleDriveBackupService.php
│   ├── Providers/
│   │   └── GoogleDriveStorageProvider.php
├── config/
│   └── filesystems.php (optional override)

```

---

✅ Requirements
--------------

[](#-requirements)

DependencyVersionPHP^8.2Laravel^11.31`spatie/laravel-backup`^9.3`google/apiclient`^2.15`irazasyed/telegram-bot-sdk`^3.15`masbug/flysystem-google-drive-ext`^2.4`yaza/laravel-google-drive-storage`^4.1---

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

[](#-contributing)

Contributions are welcome! Feel free to fork the repo, submit issues, or open pull requests for any improvements or fixes.

---

📜 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

---

👨‍💻 Author
----------

[](#‍-author)

**Ahmed Web**📧 🌐 [GitHub](https://github.com/ahmedweb)

---

🔗 Resources
-----------

[](#-resources)

- [Google Developer Console](https://console.cloud.google.com) – Create and manage your credentials
- [OAuth 2.0 Playground](https://developers.google.com/oauthplayground) – Retrieve your refresh token
- [Spatie Laravel Backup Docs](https://spatie.be/docs/laravel-backup)
- [Telegram Bot API](https://core.telegram.org/bots/api)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

4

Last Release

397d 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 (11 commits)")

---

Tags

phplaravellaravel 7laravel 8laravel 9generatorservicegithubcommandtraitsactionopen-source

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ahmedweb-laravel-backup-service/health.svg)

```
[![Health](https://phpackages.com/badges/ahmedweb-laravel-backup-service/health.svg)](https://phpackages.com/packages/ahmedweb-laravel-backup-service)
```

###  Alternatives

[prevailexcel/laravel-action-service-trait

A simple Laravel package to create actions, traits and services using artisan commands

143.5k](/packages/prevailexcel-laravel-action-service-trait)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[victorybiz/geoip-location

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

23167.8k2](/packages/victorybiz-geoip-location)

PHPackages © 2026

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