{"id":35100584,"url":"https://github.com/xbot-my/telegram-sdk","last_synced_at":"2026-01-23T06:23:17.853Z","repository":{"id":312073896,"uuid":"1046110795","full_name":"xbot-my/telegram-sdk","owner":"xbot-my","description":"PHP SDK for Telegram Bot API","archived":false,"fork":false,"pushed_at":"2026-01-02T10:11:41.000Z","size":16176,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T23:20:33.528Z","etag":null,"topics":["laravel-package","php-library","telegram"],"latest_commit_sha":null,"homepage":"http://telegram-sdk.xbot.my/","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/xbot-my.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-08-28T07:48:08.000Z","updated_at":"2026-01-02T10:11:44.000Z","dependencies_parsed_at":"2025-08-28T17:56:52.452Z","dependency_job_id":null,"html_url":"https://github.com/xbot-my/telegram-sdk","commit_stats":null,"previous_names":["xbot-my/telegram-sdk"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/xbot-my/telegram-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xbot-my%2Ftelegram-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xbot-my%2Ftelegram-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xbot-my%2Ftelegram-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xbot-my%2Ftelegram-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xbot-my","download_url":"https://codeload.github.com/xbot-my/telegram-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xbot-my%2Ftelegram-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: 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-package","php-library","telegram"],"created_at":"2025-12-27T16:47:56.049Z","updated_at":"2026-01-23T06:23:17.848Z","avatar_url":"https://github.com/xbot-my.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Bot PHP SDK\n\n一个易于使用的 PHP Telegram Bot API SDK，提供高性能客户端、语义化端点和完善的异常处理机制，并支持 Laravel 集成。\n\n---\n\n## 特性\n\n* 开箱即用\n* 异常捕获\n* 链式调用\n* 响应转换\n\n## 安装\n\n```bash\ncomposer require xbot-my/telegram-sdk\n```\n\n### Laravel\n\n```bash\nphp artisan vendor:publish --provider=\"XBot\\\\Telegram\\\\Providers\\\\TelegramServiceProvider\"\n```\n\n## 快速开始\n\n```php\nuse XBot\\\\Telegram\\\\Bot;\n\n$bot = Bot::token('YOUR_BOT_TOKEN');\n\n$me  = $bot-\u003egetMe()-\u003etoArray();\n$msg = $bot-\u003esendMessage(123456789, 'Hello')-\u003etoArray();\n$bot-\u003esetWebhook('https://example.com/telegram/webhook');\n```\n\n## Webhook 与更新处理\n\n* 在 `.env` 设置 `TELEGRAM_WEBHOOK_SECRET`，可选 `TELEGRAM_WEBHOOK_ROUTE_PREFIX`。\n* ServiceProvider 注册默认路由与中间件，校验请求头 `X-Telegram-Bot-Api-Secret-Token`。\n* 实现 `UpdateHandler` 或继承 `BaseUpdateHandler`：\n\n```php\nclass StartHandler extends BaseUpdateHandler {\n    protected function onMessage(array $u): void {\n        if ($this-\u003etext($u) === '/start') $this-\u003ereplyText($u, 'Welcome!');\n    }\n}\n```\n\n* 命令路由可继承 `CommandRouter`，如 `/start` → `onStart`，`/help foo` → `onHelp`。\n\n## 示例\n\n```php\n// WebApp\n$bot-\u003eanswerWebAppQuery($queryId, [...]);\n// Boosts\n$bot-\u003egetUserChatBoosts($chatId, $userId);\n// Stars\n$bot-\u003erefundStarPayment($userId, $chargeId);\n// Business\n$bot-\u003ereadBusinessMessage($chatId, $messageId);\n```\n\n## Telegram Bot API 9.2 新参数\n\n* `direct_messages_topic_id`：发送至频道话题\n* `suggested_post_parameters`：建议帖子\n* `reply_parameters.checklist_task_id`：回复清单任务\n\n```php\n$bot-\u003esendMessage($chatId, 'Hello', ['direct_messages_topic_id' =\u003e 1234]);\n```\n\n## 日志\n\n* 环境变量控制：\n\n    * `TELEGRAM_LOG_ENABLED`\n    * `TELEGRAM_LOG_SUPPRESS_INFO`\n    * `TELEGRAM_LOG_CHANNEL`\n* 事件：`telegram.request`、`telegram.response`、`telegram.retry` 等\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxbot-my%2Ftelegram-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxbot-my%2Ftelegram-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxbot-my%2Ftelegram-sdk/lists"}