{"id":37004164,"url":"https://github.com/merorafael/monolog-telegram-handler","last_synced_at":"2026-01-14T00:36:53.476Z","repository":{"id":44399216,"uuid":"71198800","full_name":"merorafael/monolog-telegram-handler","owner":"merorafael","description":"Monolog handler to send log by Telegram","archived":false,"fork":false,"pushed_at":"2021-01-16T21:48:16.000Z","size":19,"stargazers_count":35,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-25T00:54:00.263Z","etag":null,"topics":["handler","monolog","php","telegram"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merorafael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-18T02:01:18.000Z","updated_at":"2023-11-02T00:44:12.000Z","dependencies_parsed_at":"2022-07-15T04:00:39.186Z","dependency_job_id":null,"html_url":"https://github.com/merorafael/monolog-telegram-handler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/merorafael/monolog-telegram-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merorafael%2Fmonolog-telegram-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merorafael%2Fmonolog-telegram-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merorafael%2Fmonolog-telegram-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merorafael%2Fmonolog-telegram-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merorafael","download_url":"https://codeload.github.com/merorafael/monolog-telegram-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merorafael%2Fmonolog-telegram-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["handler","monolog","php","telegram"],"created_at":"2026-01-14T00:36:52.813Z","updated_at":"2026-01-14T00:36:53.461Z","avatar_url":"https://github.com/merorafael.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"TelegramHandler\n===============\n\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d7f41933-3e48-4c2d-befc-35aba76bf0ef/mini.png)](https://insight.sensiolabs.com/projects/d7f41933-3e48-4c2d-befc-35aba76bf0ef)\n[![Build Status](https://travis-ci.org/merorafael/telegram-handler.svg?branch=master)](https://travis-ci.org/merorafael/telegram-handler)\n[![Coverage Status](https://coveralls.io/repos/github/merorafael/telegram-handler/badge.svg?branch=master)](https://coveralls.io/github/merorafael/telegram-handler?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/mero/telegram-handler/v/stable.svg)](https://packagist.org/packages/mero/telegram-handler) \n[![Total Downloads](https://poser.pugx.org/mero/telegram-handler/downloads.svg)](https://packagist.org/packages/mero/telegram-handler) \n[![License](https://poser.pugx.org/mero/telegram-handler/license.svg)](https://packagist.org/packages/mero/telegram-handler)\n\nMonolog handler to send log by Telegram.\n\nRequirements\n------------\n\n- PHP 5.6 or above\n- cURL extension\n\nInstalation with composer\n-------------------------\n\n1. Open your project directory;\n2. Run `composer require mero/telegram-handler` to add `TelegramHandler` in your project vendor;\n3. Add `symfony/yaml` dependency if you need use the `\\Mero\\Monolog\\Formatter\\HtmlFormatter`.\n\nDeclaring handler object\n------------------------\n\nTo declare this handler, you need to know the bot token and the chat identifier(chat_id) to\nwhich the log will be sent.\n\n```php\n// ...\n$handler = new \\Mero\\Monolog\\Handler\\TelegramHandler('\u003ctoken\u003e', \u003cchat_id\u003e, \u003clog_level\u003e);\n// ...\n```\n\n**Example:**\n\n```php\n\u003c?php\n\n$log = new \\Monolog\\Logger('telegram_channel');\n\n$handler = new \\Mero\\Monolog\\Handler\\TelegramHandler(\n    '000000000:XXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n    111111111,\n    \\Monolog\\Logger::DEBUG\n);\n$handler-\u003esetFormatter(new \\Mero\\Monolog\\Formatter\\HtmlFormatter());\n$handler-\u003esetTimeout(30);\n$log-\u003epushHandler($handler);\n\n$log-\u003edebug('Message log');\n```\n\nThe above example is using HtmlFormatter for Telegram API. This feature is added on 0.3.0 release and \nyou can use declaring handler formatter to use `\\Mero\\Monolog\\Formatter\\HtmlFormatter` class.\n\nYou can set the timeout for Telegram request using `setTimeout` method, implemented on `TelegramHandler`. This feature is implemented on 0.4.0 release and this use is not required.\n\nCreating a bot\n--------------\n\nTo use this handler, you need to create your bot on telegram and receive the Bot API access token.\nTo do this, start a conversation with **@BotFather**.\n\n**Conversation example:**\n\nIn the example below, I'm talking to **@BotFather**. to create a bot named \"Cronus Bot\" with user \"@cronus_bot\".\n\n```\nMe: /newbot\n---\n@BotFather: Alright, a new bot. How are we going to call it? Please choose a name for your bot.\n---\nMe: Cronus Bot\n---\n@BotFather: Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: \nTetrisBot or tetris_bot.\n---\nMe: cronus_bot\n---\n@BotFather: Done! Congratulations on your new bot. You will find it at telegram.me/cronus_bot. You can now add a \ndescription, about section and profile picture for your bot, see /help for a list of commands. By the way, when \nyou've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure \nthe bot is fully operational before you do this.\n\nUse this token to access the HTTP API:\n000000000:XXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\nFor a description of the Bot API, see this page: https://core.telegram.org/bots/api\n```\n\nGive a chat identifier\n----------------------\n\nTo retrieve the chat_id in which the log will be sent, the recipient user will first need a conversation with \nthe bot. After the conversation has started, make the request below to know the chat_id of that conversation.\n\n**URL:** https://api.telegram.org/bot_token_/getUpdates\n\n**Example:**\n\n```\nRequest\n-------\nPOST https://api.telegram.org/bot000000000:XXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/getUpdates\n\nResponse\n--------\n{\n  \"ok\": true,\n  \"result\": [\n    {\n      \"update_id\": 141444845,\n      \"message\": {\n        \"message_id\": 111,\n        \"from\": {\n          \"id\": 111111111,\n          \"first_name\": \"Rafael\",\n          \"last_name\": \"Mello\",\n          \"username\": \"merorafael\"\n        },\n        \"chat\": {\n          \"id\": 111111111,\n          \"first_name\": \"Rafael\",\n          \"last_name\": \"Mello\",\n          \"username\": \"merorafael\",\n          \"type\": \"private\"\n        },\n        \"date\": 1480701504,\n        \"text\": \"test\"\n      }\n    }\n  ]\n}\n```\n\nIn the above request, the chat_id is represented by the number \"111111111\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerorafael%2Fmonolog-telegram-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerorafael%2Fmonolog-telegram-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerorafael%2Fmonolog-telegram-handler/lists"}