{"id":33956868,"url":"https://github.com/mostafabaghi/telegram-bot","last_synced_at":"2025-12-12T20:50:01.075Z","repository":{"id":306299312,"uuid":"1025744513","full_name":"mostafabaghi/telegram-bot","owner":"mostafabaghi","description":"A full-featured PHP class for interacting with Telegram Bot API","archived":false,"fork":false,"pushed_at":"2025-07-24T18:41:14.000Z","size":77,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-27T19:15:42.963Z","etag":null,"topics":["api","bot","php","telegram","telegram-bot-api","telegrambot"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/playlist?list=PLdhF00_39aY_c93i79pbaWdY9g_-idWHX","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/mostafabaghi.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}},"created_at":"2025-07-24T18:20:25.000Z","updated_at":"2025-08-02T12:53:24.000Z","dependencies_parsed_at":"2025-07-24T22:54:46.077Z","dependency_job_id":null,"html_url":"https://github.com/mostafabaghi/telegram-bot","commit_stats":null,"previous_names":["mostafabaghi/telegram-bot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mostafabaghi/telegram-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafabaghi%2Ftelegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafabaghi%2Ftelegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafabaghi%2Ftelegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafabaghi%2Ftelegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mostafabaghi","download_url":"https://codeload.github.com/mostafabaghi/telegram-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafabaghi%2Ftelegram-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27691287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","bot","php","telegram","telegram-bot-api","telegrambot"],"created_at":"2025-12-12T20:49:58.923Z","updated_at":"2025-12-12T20:50:01.070Z","avatar_url":"https://github.com/mostafabaghi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Bot Plus\n\n![Telegram Bot Api PHP](screenshot.png)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA modern, fully featured PHP wrapper for the Telegram Bot API — built for developers who want full control and modern structure with PSR-4 compatibility.\n\nGitHub: [github.com/mostafabaghi/telegram-bot](https://github.com/mostafabaghi/telegram-bot)\n\n---\n\n## 🚀 Features\n\n- PSR-4 autoloading\n- Full API support (sendMessage, sendMedia, Polls, Payments...)\n- Debug logging\n- Webhook handler system\n- Event Dispatcher system (like Laravel listeners)\n- IP validation for Telegram\n- File uploads via URL, local, or stream (memory)\n\n---\n\n## 📦 Installation\n\n```bash\ncomposer require mostafabaghi/telegram-bot\n```\n\n\u003e Or manually clone:\n```bash\ngit clone https://github.com/mostafabaghi/telegram-bot.git\ncd telegram-bot\ncomposer install\n```\n\n---\n\n## 🔧 Usage Example\n\n### Basic usage:\n\n```php\nuse TelegramBot\\TelegramBotPlus;\n\n$bot = new TelegramBotPlus('YOUR_BOT_TOKEN');\n$bot-\u003esendMessage(123456789, 'Hello world!');\n```\n\n### Webhook handling:\n\n```php\n$bot-\u003esetWebhookHandler(function($update) use ($bot) {\n    if (isset($update['message']['text'])) {\n        $chatId = $update['message']['chat']['id'];\n        $bot-\u003esendMessage($chatId, \"Received: \" . $update['message']['text']);\n    }\n});\n\n$bot-\u003ehandleWebhook();\n```\n\n---\n\n## 📚 Documentation\n\n### ✅ Core Methods\n\n| Method | Description |\n|--------|-------------|\n| `sendMessage($chatId, $text, $options = [])` | Send text message |\n| `sendPhoto($chatId, $photoPath, $caption = '')` | Send image |\n| `sendMedia($type, $chatId, $media, $caption = '')` | Send media (photo, video, document, ...) |\n| `sendMediaGroup($chatId, $mediaArray)` | Send album (array of media) |\n| `sendPoll($chatId, $question, $options)` | Create poll |\n| `sendInvoice(...)` | Send payment invoice |\n| `answerCallbackQuery(...)` | Answer inline button click |\n\n### ⚙️ Webhook Management\n\n```php\n$bot-\u003esetWebhook('https://yourdomain.com/webhook.php');\n$bot-\u003edeleteWebhook();\n$bot-\u003egetWebhookInfo();\n```\n\n### 💡 Event System\n\n```php\n$bot-\u003eon('message.text', function($message) use ($bot) {\n    $bot-\u003esendMessage($message['chat']['id'], 'Handled via event!');\n});\n```\n\n### 🔐 IP Validation\n\n```php\nif (!$bot-\u003eisFromTelegram()) {\n    http_response_code(403);\n    exit('Access Denied');\n}\n```\n\n---\n\n## 🧪 Testing\n\n```bash\ncomposer install\nvendor/bin/phpunit\n```\n\n---\n\n## 📜 License\n\nMIT License © [mostafabaghi](https://github.com/mostafabaghi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostafabaghi%2Ftelegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmostafabaghi%2Ftelegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostafabaghi%2Ftelegram-bot/lists"}