hotrush / laravel-backup-telegram-notifications
为 spatie/laravel-backup 添加 Telegram 通知
4.0.0
2024-05-02 11:49 UTC
Requires
- php: >=8.2
- laravel-notification-channels/telegram: ^5.0
- spatie/laravel-backup: ^8.0
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'),
],
...
],