sanf/rubot
Composer 安装命令:
composer require sanf/rubot
包简介
Rubot is a PHP framework for building Rubika bots efficiently and reliably, with full support for messaging, media, and user interactions.Rubot - Rubika Bot API SDK in PHP
README 文档
README
Rubot
PHP framework for building Rubika bots efficiently and intelligently.
Rubot
Rubot is a PHP framework for building Rubika bots. It uses the official Rubika APIs to create bots efficiently and reliably. Rubot is optimized for performance and ease of use, offering all supported methods for messaging, media, and user interactions.
Whether you need a simple chatbot or a more advanced assistant, Rubot makes development faster, smarter, and more maintainable.
V 2.1.0 PHP 8.1+
What's New?
Update v2.1.0
Overall changes
- Optimization of core classes
- Using Guzzle for sending requests, downloading, and uploading
- Updated filters in the Message class
- Optimized upload and download
- Added support for receiving updates via long polling
- Added button links for joining channels and opening URLs
- Simplified retrieval and usage of file IDs
- Added new filters
- Added progress tracking for downloads and uploads
- Added the Rubino class
Minor changes
- Added ENV file support
- Added retry count for failed requests
- Added timeout setting
- Added debugger
- Added automatic token retrieval from ENV
Initial Setup
-
Get your token from the @BotFather bot.
-
Install the Library Download the library using one of the following methods:
Using Composer
composer require sanf/rubot
# Or Install the Beta Version
composer require sanf/rubot:dev-main
Clone from GitHub
git clone https://github.com/sanf-dev/rubot composer dump-autoload
- Create a File and Run a Simple Bot
require "vendor/autoload.php"; use Rubot\Bot; use Rubot\Tools\Message; $bot = new Bot("YOUR_BOT_TOKEN"); $run = function (Message $update) use ($bot) { $update->reply("Hello, user"); }; $bot->onMessage($run); // run webhook
- Set a Webhook for Your Bot
$bot->setWebHook("WEBHOOK_URL");
- Congratulations 🎉 You have successfully set up your bot!
(Bot) Methods
Sending Message
Simple example of sending a message with the Bot class
$bot->sendMessage( "CHAT_ID", "TEXT", "REPLY_MESSAGE_ID", "DISABLE_NOTIFICATION", ["OTHER_METHOD"] );
CHAT_ID–string→ The target chat ID.TEXT–string→ The text message you want to send.REPLY_MESSAGE_ID–string→ The message ID to reply to (optional).DISABLE_NOTIFICATION–bool→ Additional options:OTHER_METHOD–array→ Additional options:inline_keypad:arraychat_keypad:arraychat_keypad_type:string
Other methods
Get familiar with the different methods
Sending Messages
sendFile:Send a file to a chatsendPoll:Send a poll to the chatsendLocation:Send a temporary locationsendContact:Send a contact (phone number & name)forwardMessage:Forward a message from one chat to another
Editing & Deleting
editMessage:Edit the content of a previously sent messagedeleteMessage:Delete a message from a chateditChatKeypad:Edit an existing chat keyboard
File Handling
getFile:Get file information using its file IDsendFile:Upload a media file to Rubika serversdownload:Download a file from its file ID to a specified path
Chat & Bot Info
getMe:Get bot account detailsgetChat:Get chat information (user, group, or channel)getUpdates:Receive incoming updates (polling method)setCommands:Set bot commands
Webhook & Security
setSecretKey:Set a security key to protect webhook accesscheckSecretKey:Check if the incoming webhook request contains the correct keysetWebHook:Automatically set webhook to a given URLonMessage:Handle incoming messages from the webhook with a callback functiononUpdate:Receive updates using long polling
(Message) Methods
text:get Messagechat_id:get Chat Idmessage_id:get Message Id
License
MIT © Sanf-Dev
sanf/rubot 适用场景与选型建议
sanf/rubot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 7, 最近一次更新时间为 2025 年 08 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「bot」 「php-bot」 「rubika」 「Rubika-Bot」 「Rubot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sanf/rubot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sanf/rubot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sanf/rubot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Clear and simple Telegram bot API
Dialogflow php sdk
Laravel 5.6 Monolog custom telegram channel
Alfabank REST API integration
VK driver for botman
Telegram bot integration with laravel
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-08