{"id":20251262,"url":"https://github.com/paranoiasystem/telegrambot-php-library","last_synced_at":"2025-04-10T22:55:00.102Z","repository":{"id":57035879,"uuid":"39685526","full_name":"paranoiasystem/TelegramBot-PHP-library","owner":"paranoiasystem","description":"TelegramBot is an unofficial library for use the Telegram APIs for bot","archived":false,"fork":false,"pushed_at":"2015-08-18T18:59:17.000Z","size":258,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T22:54:54.589Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paranoiasystem.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":"2015-07-25T13:06:30.000Z","updated_at":"2021-11-01T22:06:48.000Z","dependencies_parsed_at":"2022-08-23T20:50:55.957Z","dependency_job_id":null,"html_url":"https://github.com/paranoiasystem/TelegramBot-PHP-library","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paranoiasystem%2FTelegramBot-PHP-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paranoiasystem%2FTelegramBot-PHP-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paranoiasystem%2FTelegramBot-PHP-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paranoiasystem%2FTelegramBot-PHP-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paranoiasystem","download_url":"https://codeload.github.com/paranoiasystem/TelegramBot-PHP-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312172,"owners_count":21082638,"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","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":[],"created_at":"2024-11-14T10:02:28.212Z","updated_at":"2025-04-10T22:55:00.063Z","avatar_url":"https://github.com/paranoiasystem.png","language":"PHP","readme":"# TelegramBot-PHP-library\n\n[![Travis](https://img.shields.io/travis/paranoiasystem/TelegramBot-PHP-library.svg?style=flat-square)](https://travis-ci.org/paranoiasystem/TelegramBot-PHP-library)\n[![Packagist](https://img.shields.io/packagist/v/paranoiasystem/telegrambot-php-library.svg?style=flat-square)](https://packagist.org/packages/paranoiasystem/telegrambot-php-library)\n[![Total Downloads](https://img.shields.io/packagist/dt/paranoiasystem/telegrambot-php-library.svg?style=flat-square)](https://packagist.org/packages/paranoiasystem/telegrambot-php-library)\n[![GitHub license](https://img.shields.io/badge/license-GPLv2-blue.svg?style=flat-square)](LICENSE)\n\nTelegramBot is an unofficial library in PHP for use the [Telegram APIs for bot](https://core.telegram.org/bots/api)\n\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require paranoiasystem/telegrambot-php-library\n```\n\n## Usage\n\nSend Message\n\n``` php\n\u003c?php\n\tnamespace Telegram;\n\n    require_once __DIR__ . '/vendor/autoload.php'; \n\n\t$bot = new TelegramBot('YOUR_BOT_API_TOKEN', 'YOUR_BOT_USERNAME');\n\n\t$bot-\u003esendMessage('chat_id', 'text');\n```\n\nSend Photo\n\n``` php\n\u003c?php\n\tnamespace Telegram;\n\n    require_once __DIR__ . '/vendor/autoload.php'; \n\n\t$bot = new TelegramBot('YOUR_BOT_API_TOKEN', 'YOUR_BOT_USERNAME');\n\n\t$bot-\u003esendPhoto('chat_id', 'path_to_photo');\n\n\t//or\n\n\t$bot-\u003esendPhoto('chat_id', array('file_id'  =\u003e 'file_id_value'));\n```\n\n## Bot Example\n\nSet WebHook\n\n``` php\n\u003c?php\n\tnamespace Telegram;\n\n    require_once __DIR__ . '/vendor/autoload.php'; \n\n    $bot = new TelegramBot('YOUR_BOT_API_TOKEN', 'YOUR_BOT_USERNAME');\n\n    $response = $bot-\u003esetWebhook(\"https://url.to/hook.php\"); //only https\n\n\tif($response-\u003edescription == \"Webhook was set\")\n\t\techo \"Ok! The bot is ready!\";\n\telse{\n\t\techo \"Ops! Error \u003cbr\u003e\";\n\t\tprint_r($response);\n\t}\n?\u003e\n```\n\nBotCore (hook.php)\n\n``` php\n\u003c?php\n\tnamespace Telegram;\n\n    require_once __DIR__ . '/vendor/autoload.php'; \n\n    $bot = new TelegramBot('YOUR_BOT_API_TOKEN', 'YOUR_BOT_USERNAME');\n\n    $response = $bot-\u003ehook();\n\n\t$comand = $response-\u003emessage-\u003etext;\n\n\tif(substr($comand, 0, strlen(\"/echo\")) === \"/echo\")\n\t\t$bot-\u003esendMessage($response-\u003emessage-\u003echat-\u003eid, str_replace(\"/echo\", \"\", $comand));\n\n\tif(substr($comand, 0, strlen(\"/img\")) === \"/img\")\n\t\t$bot-\u003esendPhoto($response-\u003emessage-\u003echat-\u003eid, 'path_to_photo');\n?\u003e\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparanoiasystem%2Ftelegrambot-php-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparanoiasystem%2Ftelegrambot-php-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparanoiasystem%2Ftelegrambot-php-library/lists"}