hotrush/laravel-backup-telegram-notifications

为 spatie/laravel-backup 添加 Telegram 通知

4.0.0 2024-05-02 11:49 UTC

This package is auto-updated.

Last update: 2024-09-02 12:28:22 UTC


README

为 spatie/laravel-backup 扩展,用于添加 Telegram 通知功能。

安装

composer require hotrush/laravel-backup-telegram-notifications

配置

  • 配置 Telegram
// config/services.php
'telegram-bot-api' => [
    'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE')
],
  • 配置备份包
// config/backup.php

use NotificationChannels\Telegram\TelegramChannel;

'notifications' => [

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

    'notifiable' => \Hotrush\SpatieBackup\Notifications\Notifiable::class,

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

    ...
],