PHP code example of nhamtphat / laravel-backup-telegram-notifications

1. Go to this page and download the library: Download nhamtphat/laravel-backup-telegram-notifications library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nhamtphat / laravel-backup-telegram-notifications example snippets


// 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')),
    ],
],
bash
php artisan vendor:publish --tag="laravel-backup-telegram-config"