承接 sanf/rubot 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

logo - Rubot

Rubot

PHP framework for building Rubika bots efficiently and intelligently.

PHP Framework PHP Version Packagist

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

  1. Get your token from the @BotFather bot.

  2. 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
  1. 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
  1. Set a Webhook for Your Bot
$bot->setWebHook("WEBHOOK_URL");
  1. 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_IDstring → The target chat ID.
  • TEXTstring → The text message you want to send.
  • REPLY_MESSAGE_IDstring → The message ID to reply to (optional).
  • DISABLE_NOTIFICATIONbool → Additional options:
  • OTHER_METHODarray → Additional options:
    • inline_keypad: array
    • chat_keypad: array
    • chat_keypad_type: string

Other methods

Get familiar with the different methods

Sending Messages

  • sendFile : Send a file to a chat
  • sendPoll : Send a poll to the chat
  • sendLocation : Send a temporary location
  • sendContact : 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 message
  • deleteMessage : Delete a message from a chat
  • editChatKeypad : Edit an existing chat keyboard

File Handling

  • getFile : Get file information using its file ID
  • sendFile : Upload a media file to Rubika servers
  • download : Download a file from its file ID to a specified path

Chat & Bot Info

  • getMe : Get bot account details
  • getChat : 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 access
  • checkSecretKey : Check if the incoming webhook request contains the correct key
  • setWebHook : Automatically set webhook to a given URL
  • onMessage : Handle incoming messages from the webhook with a callback function
  • onUpdate : Receive updates using long polling

(Message) Methods

  • text : get Message
  • chat_id : get Chat Id
  • message_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 我们能提供哪些服务?
定制开发 / 二次开发

基于 sanf/rubot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 57
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-08