samueletur / laravel-error-tracking-to-telegram
This package send an alert notification to telegram when a error from laravel is executed
Requires
- irazasyed/telegram-bot-sdk: ^3.13
This package is auto-updated.
Last update: 2024-12-01 00:15:41 UTC
README
Installation
You can install the package via composer:
composer require samueletur/laravel-error-tracking-to-telegram
Call LaravelErrorTrackingToTelegram in app\Exceptions\Handler inside register function
public function register(): void { $this->reportable(function (Throwable $e) { LaravelErrorTrackingToTelegram::send($e); }); }
Configuration
Configuring for use within your Laravel app takes place mainly in the config/error_tracking_telegram.php
file. Each item is broken down in the comment lines above it, describing what that item does and what value(s) it's anticipating.
Create and set parameters on .env
TELEGRAM_BOT_TOKEN='XXXXXXXXXX:XXXXXXXxxxXXxxXxXxx-xXxxXXxXXxXXxxx'
TELEGRAM_CHAT_ID=999999999
There are also two .env variables you'll need to set depending on if you use notifications:
- TELEGRAM_BOT_TOKEN, the token of telegram app
- TELEGRAM_CHAT_ID, ID from your chat or group room.
Tip: How to create a bot token on Telegram.
- Crie uma conta no Telegram
- Inicie uma conversa com o @botfather (lembre-se que os robôs oficiais do Telegram têm um tique azul do lado do nome)
- Clique em iniciar
- Escolha o comando /newbot
- Escolha o nome do seu chatbot e faça as configurações gerais
You can publish the config file with:
php artisan vendor:publish --tag=error_tracking_telegram_config
This is the contents of the published config file:
return [ 'telegram_bot_token' => env('TELEGRAM_BOT_TOKEN'), 'telegram_chat_id' => env('TELEGRAM_CHAT_ID') ];
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.