PHPackages                             sinyor-ehsan/botkaplus - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sinyor-ehsan/botkaplus

ActiveLibrary[API Development](/categories/api)

sinyor-ehsan/botkaplus
======================

Botkaplus Library for rubika bots

2.1.0(4mo ago)366MITPHPPHP ^7.4|^8.0

Since Oct 16Pushed 4mo agoCompare

[ Source](https://github.com/EhsanGhorbany/Rubika)[ Packagist](https://packagist.org/packages/sinyor-ehsan/botkaplus)[ Docs](https://github.com/sinyor-ehsan/Rubika)[ RSS](/packages/sinyor-ehsan-botkaplus/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (28)Used By (0)

📚 PHP Library for Rubika bot
============================

[](#-php-library-for-rubika-bot)

Botkaplus Library for rubika bots.

Botkaplus
=========

[](#botkaplus)

[![](https://camo.githubusercontent.com/e905353d2ebc39f16687986a93ceea741d1951102f2cabeb8a1540d3e7c6004e/68747470733a2f2f727562696b612e69722f7374617469632f696d616765732f6c6f676f2e737667)](https://camo.githubusercontent.com/e905353d2ebc39f16687986a93ceea741d1951102f2cabeb8a1540d3e7c6004e/68747470733a2f2f727562696b612e69722f7374617469632f696d616765732f6c6f676f2e737667)

Botkaplus Library for rubika bots. یک کتابخانه قدرتمند و ساده برای ساخت ربات‌های روبیکا با PHP.

باتکاپلاس کتابخانه ای برای بات های روبیکا

📦 نصب و راه‌ اندازی
===================

[](#-نصب-و-راه‌-اندازی)

پیش نیاز

· PHP 7.4 or higher /// · curl enable /// · token rubika bot

نصب
===

[](#نصب)

نصب کردن فایل‌های کتابخانه

```
composer require sinyor-ehsan/botkaplus
```

شروع با webHook
===============

[](#شروع-با-webhook)

```

```

شروع
====

[](#شروع)

```

```

ارسال متادیتا markdown
======================

[](#ارسال-متادیتا-markdown)

```

```

ارسال متادیتا html
==================

[](#ارسال-متادیتا-html)

```

```

ارسال متادیتا markdown با utils
===============================

[](#ارسال-متادیتا-markdown-با-utils)

```

```

ارسال اینلاین کیبورد
====================

[](#ارسال-اینلاین-کیبورد)

```
use Botkaplus\InlineKeypad;

$keypad = new InlineKeypad();

// ردیف اول
$keypad->addRow([
    InlineKeypad::buttonSimple("Botkaplus_1", "Botkaplus 1")
]);

// ردیف دوم
$keypad->addRow([
    InlineKeypad::buttonSimple("Botkaplus_2", "Botkaplus 2"),
    InlineKeypad::buttonSimple("Botkaplus_3", "Botkaplus 3")
]);

$inline_keypad = $keypad->build();
$message->replyMessage("send inline keypad!", inline_keypad:$inline_keypad);
```

ارسال اینلاین Button
====================

[](#ارسال-اینلاین-button)

```
use Botkaplus\ChatKeypad;

$chat_keypad = new ChatKeypad();

// ردیف اول
$chat_keypad->addRow([
    ChatKeypad::buttonSimple("100", "Botkaplus 1")
]);

// ردیف دوم
$chat_keypad->addRow([
    ChatKeypad::buttonSimple("101", "Botkaplus 2"),
    ChatKeypad::buttonSimple("102", "Botkaplus 3")
]);

$chat_keypad->setResizeKeyboard(true);
$chat_keypad->setOnTimeKeyboard(true);

$chat_keypad = $chat_keypad->build();
$message->replyMessage("send chat keypad!", chat_keypad:$chat_keypad);
```

🧩 1. ساخت کیبورد Inline
=======================

[](#-1-ساخت-کیبورد-inline)

مثال کامل InlineKeypad

```
use Botkaplus\InlineKeypad;

$keypad = new InlineKeypad();

// ردیف اول
$keypad->addRow([
    InlineKeypad::buttonSimple("Botkaplus_1", "Botkaplus 1")
]);

// ردیف دوم
$keypad->addRow([
    InlineKeypad::buttonSimple("Botkaplus_2", "Botkaplus 2"),
    InlineKeypad::buttonSimple("Botkaplus_3", "Botkaplus 3")
]);

$linkBtn = InlineKeypad::buttonUrlLink(id: "link",title: "ورود به سایت", url: "https://example.com");

$join_button = InlineKeypad::buttonJoinChannelData(id: "join_button", text:"کانال ما", username:"Botkaplus");

$button_open_chat = InlineKeypad::buttonOpenChat(id:"open_chat", text:"باز کردن چت", object_guid:"u0aaaa", object_type:"User");

// $keypad->addRow($linkBtn);

$inline_keypad = $keypad->build();

// ارسال پیام همراه با کیبورد
$message->replyMessage("Inline keypad example", inline_keypad: $inline_keypad);
```

- 🔄 ارسال همه دکمه‌ها به‌صورت InlineKeypad
------------------------------------------

[](#---ارسال-همه-دکمه‌ها-به‌صورت-inlinekeypad)

در Botkaplus، تقریباً تمام دکمه‌های ChatKeypad (به‌جز چند مورد خاص) می‌توانند به‌صورت Inline نیز ارسال شوند.

🧩 2. ساخت کیبورد Chat (پیشرفته)
===============================

[](#-2-ساخت-کیبورد-chat-پیشرفته)

کیبورد Chat شامل انواع دکمه‌های تعاملی است:

- انتخاب (Selection)
- تقویم (Calendar)
- انتخاب عدد (Number Picker)
- انتخاب رشته (String Picker)
- انتخاب موقعیت (Location Picker)
- ورودی متنی (Textbox)
- ارسال فایل، عکس، ویدیو، صوت
- درخواست شماره/موقعیت کاربر
- لینک
- بارکد مثال کامل ChatKeypad

```
use Botkaplus\ChatKeypad;

$keypad = new ChatKeypad();

// آیتم‌های انتخاب
$items = [
    ChatKeypad::selectionItem("سیب", "https://upload.wikimedia.org/wikipedia/commons/1/15/Red_Apple.jpg"),
    ChatKeypad::selectionItem("موز", "https://upload.wikimedia.org/wikipedia/commons/8/8a/Banana-Single.jpg")
];

// دکمه انتخاب
$button = ChatKeypad::buttonSelection(
    id: "2",
    text: "انتخاب میوه",
    selection_id: "fruit_select_1",
    title: "انتخاب میوه",
    items: $items
);

$button_simple = InlineKeypad::buttonSimple("Botkaplus_1", "Botkaplus 1");

$keypad->addRow([$button, $button_simple]);
// ساخت نهایی
$keypad = $keypad->build();
// ارسال $keypad با متد sendMessage
```

```
use Botkaplus\ChatKeypad;
$keypad = new ChatKeypad();

// دکمه تقویم
$btn = ChatKeypad::buttonCalendar(
    id: "cal1",
    title: "انتخاب تاریخ",
    type: "DatePersian",
    default_value: "1402/01/01",
    min_year: "1390",
    max_year: "1410"
);

// دکمه انتخاب عدد
$btn_num = ChatKeypad::buttonNumberPicker(
    id: "num1",
    title: "انتخاب عدد",
    min_value: "1",
    max_value: "100",
    default_value: "10"
);

$keypad->addRow([$btn, $btn_num]);
// ساخت نهایی
$keypad = $keypad->build();
```

```
use Botkaplus\ChatKeypad;
$keypad = new ChatKeypad();

// دکمه انتخاب رشته
$btn_str = ChatKeypad::buttonStringPicker(
    id: "pick1",
    title: "انتخاب رشته",
    items: ["PHP", "Python", "Go", "Rust"],
    default_value: "PHP"
);

// دکمه موقعیت
$btn_loc = ChatKeypad::buttonLocation(
    id: "loc1",
    type: "Picker",
    location_image_url: "https://example.com/location.png",
    default_pointer_location: ["latitude" => 35.6892, "longitude" => 51.3890],
    default_map_location: ["latitude" => 35.7000, "longitude" => 51.4000],
    title: "ارسال موقعیت"
);

$keypad->addRow([$but_str, $btn_loc]);
// ساخت نهایی
$keypad = $keypad->build();
```

```
use Botkaplus\ChatKeypad;
$keypad = new ChatKeypad();

$btn_tbo = ChatKeypad::buttonTextbox(
    id: "txt1",
    title: "نام شما",
    type_line: "SingleLine",
    type_keypad: "String",
    place_holder: "اینجا بنویسید...",
    default_value: null
);

$btn_p = ChatKeypad::buttonPayment(
    id: "pay1",
    title: "پرداخت",
    amount: 50000,
    description: "پرداخت هزینه اشتراک"
);

// دکمه‌های رسانه
$btn_camera = ChatKeypad::buttonCameraImage(id: "cam1", title: "ارسال عکس با دوربین");
$btn_ca_v   = ChatKeypad::buttonCameraVideo(id: "camv1", title: "ارسال ویدیو با دوربین");
$btn_g_im   = ChatKeypad::buttonGalleryImage(id: "gal1", title: "انتخاب عکس از گالری");
$btn_g_vi   = ChatKeypad::buttonGalleryVideo(id: "gal2", title: "انتخاب ویدیو از گالری");
$btnFile    = ChatKeypad::buttonFile(id: "file1", title: "ارسال فایل");
$btnAudio   = ChatKeypad::buttonAudio(id: "audio1", title: "ارسال صوت");
$btnRecord  = ChatKeypad::buttonRecordAudio(id: "rec1", title: "ارسال ویس");

$btnPhone = ChatKeypad::buttonMyPhoneNumber(id: "phone1", title: "ارسال شماره من");

$btnLocation = ChatKeypad::buttonMyLocation(id: "loc1", title: "ارسال موقعیت من");

// لینک
$btnLink = ChatKeypad::buttonLink(
    id: "link1",
    title: "ورود به سایت",
    url: "https://rubika.ir"
);

$linkBtn = ChatKeypad::createLinkButton(title: "ورود به سایت", url: "https://example.com");

// درخواست شماره و موقعیت
$btnAskPhone = ChatKeypad::buttonAskMyPhoneNumber(id: "ask_phone", title: "ارسال شماره‌ام");
$btnAskLocation = ChatKeypad::buttonAskLocation(id: "ask_loc", title: "ارسال موقعیت");

// بارکد
$barcodeBtn = ChatKeypad::buttonBarcode(id: "bar1", title: "اسکن بارکد");

// اضافه کردن ردیف‌ها
$keypad->addRow([$barcodeBtn, $btn_tbo]);
$keypad->addRow([$btn_camera, $btn_ca_v]);
$keypad->addRow([$barcodeBtn]);

// ساخت نهایی
$keypad = $keypad->build();

// ارسال پیام همراه با کیبورد
$message->replyMessage("**hello __from ~~[Botkaplus!](https://github.com/sinyor-ehsan/Rubika)~~__**", chat_keypad: $keypad);
```

📦 خروجی نهایی هر دو نوع کیبورد در نهایت با متد build() ساخته می‌شوند و سپس در متد replyMessage() یا هر متد ارسال پیام (ارسال انواع فایل) دیگر قرار می‌گیرند.

✨ نکات مهم

- تمام دکمه‌ها Static Method هستند و ساختار یکپارچه دارند.
- هر ردیف با addRow() اضافه می‌شود.
- خروجی نهایی همیشه یک آرایهٔ JSON-ready است.

ادامه ندادن به هندلرهای بعدی
============================

[](#ادامه-ندادن-به-هندلرهای-بعدی)

```
$bot->stopPropagation()
```

فیلتر text
==========

[](#فیلتر-text)

```
$bot->onMessage(Filters::text("hello"), function(BotClient $bot, Message $message){
    $message->replyMessage("hello from Botkaplus!");
});
```

فیلتر ترکیبی and
================

[](#فیلتر-ترکیبی-and)

```
$bot->onMessage(Filters::and(Filters::private(), Filters::command("start")), function(BotClient $bot, Message $message){
    $message->replyMessage("hello from Botkaplus to pv!");
});
```

انواع فیلترها
=============

[](#انواع-فیلترها)

```
Filters::text("")
Filters::regex("")
Filters::command("")
Filters::chatId("")
Filters::senderId("")
Filters::buttonId("")
Filters::private()
Filters::group()
Filters::channel()
Filters::or(...)
Filters::and(...)
Filters::not(...)
```

تنظیم کامندها
=============

[](#تنظیم-کامندها)

```
$bot->setCommands([["command" => "start", "description" => "شروع ربات"], ["command" => "help", "description" => "راهنمای ربات"]]);
```

ارسال نظرسنجی
=============

[](#ارسال-نظرسنجی)

```
// chat_id شناسه چت مقصد
// question متن سوال
// options array[string] گزینه های سوال
// type ["Regular", "Quiz"] = "Regular" نوع
// allows_multiple_answers .کاربرد دارد "regular" فقط برای نوع e انتخاب چند گزینه
// is_anonymous باشد، رأی‌دهی ناشناس است و نام رأی‌دهندگان نمایش داده نمی‌شود true اگر
// correct_option_index "Quiz" ایندکس گزینه درست در حالت
// hint توضیح نظرسنجی
$bot->sendPoll(chat_id:$bot->chat_id, question:"سوال", options:["one", "two"], type:"Quiz", is_anonymous:false, correct_option_index:"0", hint:"توضیحات")
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance76

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

27

Last Release

129d ago

Major Versions

0.6.1 → 1.0.02025-12-26

1.1.0 → 2.0.02025-12-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/10bec2d54bc1888287b8aa5f5d2eb2e7e17d443af2583c237c1a83d1d19ae410?d=identicon)[EhsanGhorbany](/maintainers/EhsanGhorbany)

---

Top Contributors

[![EhsanGhorbany](https://avatars.githubusercontent.com/u/238211118?v=4)](https://github.com/EhsanGhorbany "EhsanGhorbany (191 commits)")

---

Tags

apibotbotkaplusphpphp-rubika-botrubikarubika-botrubika-bot-apirubika-bot-phprubika-libraryrubikabotphpapibotrubikarubikabotbotkaplus

### Embed Badge

![Health badge](/badges/sinyor-ehsan-botkaplus/health.svg)

```
[![Health](https://phpackages.com/badges/sinyor-ehsan-botkaplus/health.svg)](https://phpackages.com/packages/sinyor-ehsan-botkaplus)
```

###  Alternatives

[borsaco/telegram-bot-api-bundle

A simple wrapper for telegram-bot-api.

5633.0k](/packages/borsaco-telegram-bot-api-bundle)[klev-o/telegram-bot-api

Simple and convenient object-oriented implementation Telegram bot API with php version ^7.4 support. You'll like it)

457.8k1](/packages/klev-o-telegram-bot-api)[klev-o/crypto-pay-api

Simple and convenient implementation of the Crypto Pay payment system (@CryptoBot)

205.1k](/packages/klev-o-crypto-pay-api)[kuvardin/telegram-bots-api

SDK for Telegram bots API

145.5k](/packages/kuvardin-telegram-bots-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
