nhamtphat/laravel-backup-telegram-notifications

Telegram notifications for spatie/laravel-backup

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 5

pkg:composer/nhamtphat/laravel-backup-telegram-notifications

1.0.0 2026-02-13 06:59 UTC

This package is auto-updated.

Last update: 2026-02-13 07:04:08 UTC


README

Latest Version on Packagist Total Downloads License

A wrapper for spatie/laravel-backup to send beautified Telegram notifications. This package is a fork of hotrush/laravel-backup-telegram-notifications.

✨ Features

  • Beautified Notifications: Rich HTML-formatted Telegram messages with emojis and clear structure.
  • Easy Integration: Seamlessly works with the existing Spatie Backup notification system.
  • Customizable: Uses Blade views for notification templates, allowing for easy customization.

🚀 Installation

You can install the package via composer:

composer require nhamtphat/laravel-backup-telegram-notifications

⚙️ Configuration

1. Configure Telegram Bot

Add your Telegram Bot Token to your config/services.php file:

// config/services.php
'telegram-bot-api' => [
    'token' => env('TELEGRAM_BOT_TOKEN'),
],

2. Configure Backup Notifications

In your config/backup.php file, update the notifications section to use the Telegram channel and this package's notification classes.

// config/backup.php

use NotificationChannels\Telegram\TelegramChannel;
use NhamtPhat\SpatieBackup\Notifications\Notifiable;
use NhamtPhat\SpatieBackup\Notifications\Notifications\BackupHasFailedNotification;
use NhamtPhat\SpatieBackup\Notifications\Notifications\BackupWasSuccessfulNotification;
use NhamtPhat\SpatieBackup\Notifications\Notifications\CleanupHasFailedNotification;
use NhamtPhat\SpatieBackup\Notifications\Notifications\CleanupWasSuccessfulNotification;
use NhamtPhat\SpatieBackup\Notifications\Notifications\HealthyBackupWasFoundNotification;
use NhamtPhat\SpatieBackup\Notifications\Notifications\UnhealthyBackupWasFoundNotification;

'notifications' => [
    'notifications' => [
        BackupHasFailedNotification::class => [TelegramChannel::class],
        UnhealthyBackupWasFoundNotification::class => [TelegramChannel::class],
        CleanupHasFailedNotification::class => [TelegramChannel::class],
        BackupWasSuccessfulNotification::class => [TelegramChannel::class],
        HealthyBackupWasFoundNotification::class => [TelegramChannel::class],
        CleanupWasSuccessfulNotification::class => [TelegramChannel::class],
    ],

    'notifiable' => Notifiable::class,

    'telegram' => [
        'channel_id' => env('TELEGRAM_CHAT_ID'),
    ],
],

Don't forget to add TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID to your .env file.

🛠 Usage

Once configured, notifications will be sent automatically by the spatie/laravel-backup package whenever a backup event occurs.

📄 License

The MIT License (MIT). Please see License File for more information.