nvnhan0810 / laravel-telegram-logging
Laravel log channel — send warnings/errors to Telegram with optional queue and message templates.
Package info
github.com/nvnhan0810/laravel-telegram-logging
pkg:composer/nvnhan0810/laravel-telegram-logging
v1.0.0
2026-06-08 15:22 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/log: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- monolog/monolog: ^3.0
Requires (Dev)
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.0|^12.0
README
Laravel log channel that sends warning / error logs to Telegram.
Features
- Configurable minimum log level (
TELEGRAM_LOG_LEVEL) - Optional queue (
TELEGRAM_LOG_QUEUE=true) — does not block HTTP requests - Custom HTML message template with placeholders (
{%app_name%},{%config:app.url%}, …) - Dedupe identical messages within a time window
Install
composer require nvnhan0810/laravel-telegram-logging
Or path repository (monorepo / local dev):
"repositories": [ { "type": "path", "url": "../laravel-telegram-logging" } ], "require": { "nvnhan0810/laravel-telegram-logging": "@dev" }
Publish config (optional):
php artisan vendor:publish --tag=telegram-logging-config
Logging setup
In config/logging.php:
'telegram' => [ 'driver' => 'telegram-logging', 'level' => env('TELEGRAM_LOG_LEVEL', 'warning'), ],
In .env:
LOG_STACK=daily,telegram TELEGRAM_BOT_TOKEN= TELEGRAM_CHAT_ID= TELEGRAM_LOG_ENABLED=true TELEGRAM_LOG_LEVEL=warning TELEGRAM_LOG_QUEUE=false # TELEGRAM_LOG_QUEUE_CONNECTION= # TELEGRAM_LOG_QUEUE_NAME=
Test
php artisan telegram-log:test
Template placeholders
| Placeholder | Value |
|---|---|
{%emoji%} |
Level emoji |
{%level%} |
WARNING, ERROR, … |
{%level_lower%} |
warning, error, … |
{%message%} |
Log message (HTML escaped) |
{%context%} |
Context JSON (escaped) |
{%context_block%} |
<pre>…</pre> or empty |
{%app_name%} |
config('app.name') |
{%app_env%} |
config('app.env') |
{%channel%} |
Log channel name |
{%datetime%} |
ISO-8601 timestamp |
{%config:app.url%} |
Any config('…') value |
Override in config/telegram-logging.php → template.
Queue
When TELEGRAM_LOG_QUEUE=true, log records are dispatched to the default (or configured) queue. Run a worker:
php artisan queue:work
License
MIT