maatify/telegram-bot
Composer 安装命令:
composer require maatify/telegram-bot
包简介
Unofficial Telegram SDK for PHP it's library for maatify.dev Telegram Bot handler, known by our team
README 文档
README
Installation
composer require maatify/telegram-bot
https://core.telegram.org/bots/api#available-methods // telegram api references
Usage
Instance
use Maatify\TelegramBot\TelegramBotManager; require __DIR__ . '/vendor/autoload.php'; $telegram = TelegramBotManager::obj(__YOUR_API_KEY__); // instance of bot manager
GetMe
Get Bot Information
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.
$response = $telegram->Methods()->GetMe(); // get bot account information print_r($response);
logOut
Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.
$logout = $telegram->Methods()->Logout(); print_r($logout);
Close
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.
$close = $telegram->Methods()->Close(); print_r($close);
Webhook
- WEBHOOK Usage and examples - WEBHOOK.md
Sender
- Sending Files, Messages, Actions examples - SENDER.md
Updates
- (To get the list of updates, the web Hook should not be set) examples - UPDATES.md
GetChat
Get Chat By chat_id
$chat = $telegram->GetChat(123456); // set getChat by chat_id $by_chat = $chat->Get(); // get array of getChat $chat_id = $chat->GetID(); // get id from getChat by chat_id $chat_first_name = $chat->GetFirstName(); // get first_name from getChat $chat_last_name = $chat->GetLastName(); // get last_name from getChat $chat_username = $chat->GetUsername(); // get username from getChat $chat_type = $chat->GetType(); // get type from getChat $chat_active_username = $chat->GetActiveUsername(); // get array of active_username from getChat
getUserProfilePhotos
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
try { $telegram->Downloader()->DownloadUserProfilePhotos($user_id); } catch (Exception $e) { print_r($e->getMessage()); }
Login Page Example
- you can create login page with your bot examples - LOGIN.md
maatify/telegram-bot 适用场景与选型建议
maatify/telegram-bot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 179 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「bot」 「handler」 「telegram」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 maatify/telegram-bot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maatify/telegram-bot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 maatify/telegram-bot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lazy loading for middleware and request handlers
Dialogflow php sdk
Set Links with a specific language parameter
Laravel 5.6 Monolog custom telegram channel
Bootstraps errors and handles them via reporters and renderers
PHP Error Handler module that captures and displays all throwable errors in a given format, making debugging easier and more efficient
统计信息
- 总下载量: 179
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-07-15