rubika/app
最新稳定版本:v1.3
Composer 安装命令:
composer require rubika/app
包简介
rubika library for making apps with PHP
README 文档
README
rubika client for running bots with PHP. use this client to make bots, games and ...
usage
run this command on terminal
composer require rubika/app
-
create a new php file in current directory
-
require vendor and Bot class in file
require_once __DIR__ . '/vendor/autoload.php'; use Rubika\Bot;
- now you can send messages
$bot = new Bot(9123456789); $bot->sendMessage('u0FFeu...', 'سلام');
get message updates
for getting updates, you must create new class with a name and call it
require_once __DIR__ . '/vendor/autoload.php'; use Rubika\Client; class myBot extends Client { function onStart(): void # required ! { echo 'bot running ... '; } function runBot(array $update) # required ! { foreach ((isset($update['message']) ? $update['message'] : $update) as $message) { $message = isset($message['message']) ? $message['message'] : $message; $msg_id = $message['message_id']; $text = $message['text']; $type = $message['type']; $user_id = $message['author_object_guid']; $this->sendMessage($user_id, 'پیامتان دریافت شد ;)'); } } } new myBot(9123456789);
error exceptions
we created exception system for all possible errors you can catch them with try/catch :
use Rubika\Exception\Error; try { $bot = new Bot(9123456789); $bot->sendMessage('u0FFeu...', 'سلام'); } catch (Error $e) { echo $e->getMessage(); } // or for updates : try { new myBot(9206634543); } catch (Error $e) { echo $e->getMessage(); }
| code | describtion |
|---|---|
| 1 | invalid phone input |
| 2 | possible API errors (response) |
| 3 | not have an intenet connetion |
| 4 | API general error |
| 5 | invalid login code input |
| 6 | invalid twostep verifition password |
| 7 | login code time is expired |
| 8 | account session terminated error |
| 9 | login code is invalid |
| 10 | account session terminated error (in web login mode) |
| 11 | invalid message options |
| 12 | library cant find web index file |
| 13 | account new username is already exists on server and you can't set it as new username |
| 14 | invalid action |
| 15 | not file exists |
| 16 | file mie is invalid |
| 17 | invalid data passed |
| 18 | not understandable object ID |
| 19 | invalid join link |
| 20 | invalid username |
| 21 | invalid email |
web mode
if you runs your bot on web page or want to make web page, we have a way too ;)
Note : with runnig on web page, Bot will active web mode automatic
require_once __DIR__ . '/vendor/autoload.php'; $page = Web(9123456789); // $page = Web(9123456789, 'index.php'); you can add a custom index file // index file: // <?php // echo 'its OK ;)'; // ?> $page->sendMessage("uFF...", 'سلام');
* web login feature will improve on the text versions ...
fast mode
you can get message updates without writing class or ...
require_once __DIR__ . '/vendor/autoload.php'; Fast(function ($update, $obj) { foreach ((isset($update['message']) ? $update['message'] : $update) as $message) { $message = isset($message['message']) ? $message['message'] : $message; $msg_id = $message['message_id']; $text = $message['text']; $type = $message['type']; $user_id = $message['author_object_guid']; $obj->sendMessage($user_id, 'پیامتان دریافت شد ;)'); } }, 9123456789);
auto send message action
now you can set auto send action mode to your media like send messgae, photo, ... .
Fast(function ($update, $obj) { // ... $obj->autoSendAction = true; // ... }, 9123456789);
rubika/app 适用场景与选型建议
rubika/app 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 10 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rubika」 「rubikalib」 「rubika-lib」 「rubikalibrary」 「rubika-library」 「rubika library」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rubika/app 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rubika/app 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rubika/app 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Rubika-PHP is a PHP Library for interaction with rubika (social network)
A library for working with rubika API from PHP source code
A PHP library for Rubika Bot API
Botkaplus Library for rubika bots
A simple and lightweight client for connecting to Rubika and Shad messaging platforms, designed for easy integration and efficient setup of user-friendly applications. This library provides essential functionalities for sending and receiving messages, managing user sessions, and ensuring smooth comm
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
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2024-10-10