{"id":41404330,"url":"https://github.com/mbpcoder/laravel-monolog-telegram","last_synced_at":"2026-01-23T13:19:05.953Z","repository":{"id":57067821,"uuid":"312832719","full_name":"mbpcoder/laravel-monolog-telegram","owner":"mbpcoder","description":"Send Laravel exception to Telegram base one Monolog","archived":false,"fork":false,"pushed_at":"2025-11-03T19:48:05.000Z","size":77,"stargazers_count":28,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T21:21:06.847Z","etag":null,"topics":["laravel","monolog","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbpcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-14T14:26:15.000Z","updated_at":"2025-11-03T19:48:08.000Z","dependencies_parsed_at":"2025-04-05T11:22:21.071Z","dependency_job_id":"7d27bd5c-bd8e-4130-b8ef-8825d61c0ef5","html_url":"https://github.com/mbpcoder/laravel-monolog-telegram","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.1428571428571429,"last_synced_commit":"20a0553c09bb5c1af32c010eef335516abcad34e"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/mbpcoder/laravel-monolog-telegram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbpcoder%2Flaravel-monolog-telegram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbpcoder%2Flaravel-monolog-telegram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbpcoder%2Flaravel-monolog-telegram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbpcoder%2Flaravel-monolog-telegram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbpcoder","download_url":"https://codeload.github.com/mbpcoder/laravel-monolog-telegram/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbpcoder%2Flaravel-monolog-telegram/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28693320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","monolog","telegram","telegram-bot"],"created_at":"2026-01-23T13:19:02.543Z","updated_at":"2026-01-23T13:19:05.942Z","avatar_url":"https://github.com/mbpcoder.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time Laravel exception logs in your Telegram 🚀\n\n## ScreenShot\n\n![image](https://user-images.githubusercontent.com/3877538/172431112-020d7a7c-f515-49bc-961a-3f63c9ff21af.png)\n\n## ❓ Why Another Logger?\n\nLogging should be more than just saving data — it should **drive action**. Here’s why 🔔 **Telegram Handler for Monolog** 📝 is a game-changer:\n\n- 🚀 **Real-Time Feedback** – Instantly receive logs in your Telegram chat.\n- 🧠 **Actionable Insights** – Include useful context for quick understanding.\n- 🛡️ **No Need for Sentry or Third-Party Services**\n- ⚡ **Immediate Alerts** – Be notified of issues the moment they happen.\n- 👥 **Team Collaboration** – Share logs in group chats for quick follow-up.\n- 🧩 **Easy Customization** – Use PHP attributes to control log routing.\n\n## 🎯 Installation\n\nInstall via Composer:\n\n```sh\ncomposer require thecoder/laravel-monolog-telegram\n```\n\n## ⚙️ Usage\n\nUpdate your `config/logging.php` file to configure the Telegram logging channel.\n\n### ⏳ Running Logs in a Queue\n\nIf a queue name is set, logs will be processed asynchronously in the specified queue. Otherwise, they will run synchronously.\n\n### 🔧 Configuration Example\n\nModify your `config/logging.php` file:\n\n```php\nuse TheCoder\\MonologTelegram\\Attributes\\EmergencyAttribute;\nuse TheCoder\\MonologTelegram\\Attributes\\CriticalAttribute;\nuse TheCoder\\MonologTelegram\\Attributes\\ImportantAttribute;\nuse TheCoder\\MonologTelegram\\Attributes\\DebugAttribute;\nuse TheCoder\\MonologTelegram\\Attributes\\InformationAttribute;\nuse TheCoder\\MonologTelegram\\Attributes\\LowPriorityAttribute;\n\nreturn [\n    'channels' =\u003e [\n        'stack' =\u003e [\n            'driver'   =\u003e 'stack',\n            'channels' =\u003e ['single', 'telegram'],\n        ],\n\n        'telegram' =\u003e [\n            'driver' =\u003e 'monolog',\n            'level' =\u003e 'debug',\n            'handler' =\u003e TheCoder\\MonologTelegram\\TelegramBotHandler::class,\n            'handler_with' =\u003e [\n                'token' =\u003e env('LOG_TELEGRAM_BOT_TOKEN'),\n                'chat_id' =\u003e env('LOG_TELEGRAM_CHAT_ID'),\n                'topic_id' =\u003e env('LOG_TELEGRAM_TOPIC_ID', null),\n                'bot_api' =\u003e env('LOG_TELEGRAM_BOT_API', 'https://api.telegram.org/bot'),\n                'proxy' =\u003e env('LOG_TELEGRAM_BOT_PROXY', null),\n                'queue' =\u003e env('LOG_TELEGRAM_QUEUE', null),\n                'timeout' =\u003e env('LOG_TELEGRAM_TIMEOUT', 5),\n                'topics_level' =\u003e [\n                    EmergencyAttribute::class =\u003e env('LOG_TELEGRAM_EMERGENCY_ATTRIBUTE_TOPIC_ID', null),\n                    CriticalAttribute::class =\u003e env('LOG_TELEGRAM_CRITICAL_ATTRIBUTE_TOPIC_ID', null),\n                    ImportantAttribute::class =\u003e env('LOG_TELEGRAM_IMPORTANT_ATTRIBUTE_TOPIC_ID', null),\n                    DebugAttribute::class =\u003e env('LOG_TELEGRAM_DEBUG_ATTRIBUTE_TOPIC_ID', null),\n                    InformationAttribute::class =\u003e env('LOG_TELEGRAM_INFORMATION_ATTRIBUTE_TOPIC_ID', null),\n                    LowPriorityAttribute::class =\u003e env('LOG_TELEGRAM_LOWPRIORITY_ATTRIBUTE_TOPIC_ID', null),\n                ]\n            ],\n            'formatter' =\u003e TheCoder\\MonologTelegram\\TelegramFormatter::class,\n            'formatter_with' =\u003e [\n                'tags' =\u003e env('LOG_TELEGRAM_TAGS', null),\n            ],\n        ],\n    ],\n];\n```\n\n### 🏷️ Topic-Based Logging\n\nYou can assign a **PHP Attribute (Annotation)** to controller methods, command handlers, or job handlers, enabling topic-based logging. The package will use the first detected attribute to determine the topic for logging messages.\n\n#### 💡 Example:\n\n**📌 Controller Method:**\n\n```php\nnamespace App\\Http\\Controllers\\NewWeb;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse TheCoder\\MonologTelegram\\Attributes\\EmergencyAttribute;\n\nclass HomeController extends Controller\n{\n    #[EmergencyAttribute]\n    public function index(Request $request)\n    {\n        // Your logic here\n    }\n}\n```\n\n**⚡ Command or Job Handler:**\n\n```php\nnamespace App\\Jobs;\n\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Contracts\\Queue\\ShouldBeQueued;\nuse Illuminate\\Foundation\\Bus\\Dispatchable;\nuse TheCoder\\MonologTelegram\\Attributes\\CriticalAttribute;\n\nclass ProcessData implements ShouldBeQueued\n{\n    use Dispatchable, Queueable;\n\n    #[CriticalAttribute]\n    public function handle()\n    {\n        // Job processing logic\n    }\n}\n```\n\n**⚙️ Livewire Component Route:**\n\n```html\n    \u003cform wire:submit.prevent=\"save\"\u003e\n```\n\n```php\nclass CreatePost extends Component\n{\n    #[CriticalAttribute]\n    public function save()\n    {\n        \n    }\n\n    public function render()\n    {\n        return view('livewire.create-post');\n    }\n}\n```\n\n\n\n### 🔄 Customizing Log Settings at Runtime\n\nYou can dynamically set the bot token, chat ID, and topic ID while logging:\n\n```php\nlogger('message', [\n    'token' =\u003e 'your_bot_token',\n    'chat_id' =\u003e 'your_chat_id',\n    'topic_id' =\u003e 'your_topic_id'\n]);\n```\n\n## 📜 Environment Variables\n\nEnsure the following variables are set in your `.env` file:\n\n```ini\nLOG_TELEGRAM_BOT_TOKEN=\nLOG_TELEGRAM_CHAT_ID=\n\n# 🏷️ If using chat groups with topic support, define the topic ID\nLOG_TELEGRAM_TOPIC_ID=\n\n# 🌍 Optional: Change the API endpoint (default is Telegram's official API)\nLOG_TELEGRAM_BOT_API='https://api.telegram.org/bot'\n\n# 🛡️ Optional: Use a proxy (e.g., Tor for restricted regions)\nLOG_TELEGRAM_BOT_PROXY='socks5h://localhost:9050'\n\n# 🔥 Topic Level Configurations\nLOG_TELEGRAM_EMERGENCY_ATTRIBUTE_TOPIC_ID=\nLOG_TELEGRAM_CRITICAL_ATTRIBUTE_TOPIC_ID=\nLOG_TELEGRAM_IMPORTANT_ATTRIBUTE_TOPIC_ID=\nLOG_TELEGRAM_DEBUG_ATTRIBUTE_TOPIC_ID=\nLOG_TELEGRAM_INFORMATION_ATTRIBUTE_TOPIC_ID=\nLOG_TELEGRAM_LOWPRIORITY_ATTRIBUTE_TOPIC_ID=\n```\n\n## 📄 License\n\nThis package is open-source and available under the MIT License. 🏆\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbpcoder%2Flaravel-monolog-telegram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbpcoder%2Flaravel-monolog-telegram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbpcoder%2Flaravel-monolog-telegram/lists"}