nhamtphat/laravel-backup-telegram-notifications

Telegram notifications for spatie/laravel-backup

Maintainers

Package info

github.com/nhamtphat/laravel-backup-telegram-notifications

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

Statistics

Installs: 32

Dependents: 0

Suggesters: 0

Stars: 0

v1.2.0 2026-05-16 06:27 UTC

This package is auto-updated.

Last update: 2026-05-16 06:27:49 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 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_BACKUP_CHAT_ID', env('TELEGRAM_CHAT_ID')),
    ],
],

Alternatively, you can publish the package config file:

php artisan vendor:publish --tag="laravel-backup-telegram-config"

This will create a config/backup-telegram.php file where you can manage your Telegram settings. The package will automatically use these values as fallbacks if they are not defined in config/backup.php.

Don't forget to add TELEGRAM_BACKUP_BOT_TOKEN (or TELEGRAM_BOT_TOKEN) and TELEGRAM_BACKUP_CHAT_ID (or 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.