PHPackages                             botfire/botfire - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. botfire/botfire

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

botfire/botfire
===============

Telegram Robot Library

2.0.0.beta2(11mo ago)887721MITPHPPHP &gt;=8.1.0CI passing

Since May 15Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/botfire/botfire)[ Packagist](https://packagist.org/packages/botfire/botfire)[ RSS](/packages/botfire-botfire/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)DependenciesVersions (25)Used By (1)

Telegram Robot Library
======================

[](#telegram-robot-library)

[![Latest Stable Version](https://camo.githubusercontent.com/41308a97508abb593ac24943ad4068d3725724d1dfd87a3ebf38c49480c5b504/68747470733a2f2f706f7365722e707567782e6f72672f626f74666972652f626f74666972652f76)](//packagist.org/packages/botfire/botfire) [![Total Downloads](https://camo.githubusercontent.com/72d13bb0af7b872ae96b3464eed7c29c3fd7ee8a536d3c6936c7f69e00b71b78/68747470733a2f2f706f7365722e707567782e6f72672f626f74666972652f626f74666972652f646f776e6c6f616473)](//packagist.org/packages/botfire/botfire) [![PHP Composer](https://github.com/botfire/botfire/actions/workflows/php.yml/badge.svg)](https://github.com/botfire/botfire/actions/workflows/php.yml)

Botfire is a modern library that is used to build different types of Telegram bot projects. Likewise, a dedicated framework has been created for this purpose, which doubles the simplicity of construction and development

### Install Botfire Library

[](#install-botfire-library)

```
composer require botfire/botfire

```

use

```
use botfire\botfire\bot;
```

Set Token

```
bot::token('your-bot-token');
bot::autoInput();
```

Webhook
-------

[](#webhook)

Set Webhook

```
$result = bot::webhook()->url( $url )->set();
```

Get Webhook

```
$get = bot::webhook()->getInfo();

echo $get;
```

Message
-------

[](#message)

- [Receive messages and files and how to validate](https://github.com/botfire/botfire/wiki/Receive-messages-and-files-and-how-to-validate)

Send Message

```
bot::id($chat_id)->message('...')->send();

// auto set chat_id
bot::this()->message('...')->send();
```

Send Photo

```
bot::id($chat->id)->photo($file_id)->send();
```

Send Audio

```
bot::id($chat->id)->audio($file_id)->send();
```

Send Voice

```
bot::id($chat->id)->voice($file_id)->send();
```

Send Video Note

```
bot::id($chat->id)->videoNote($file_id)->send();
```

Send Video

```
bot::id($chat->id)->video($file_id)->send();
```

Send Animation

```
bot::id($chat->id)->animation($file_id)->send();
```

Send Document

```
bot::id($chat->id)->document($file_id)->send();
```

Send Contact

```
bot::id($chat->id)->contact($phone_number,$first_name,$last_name)->send();
```

Send chat action

```
bot::id($chat->id)->chatAction($action)->send();
```

> 'typing','upload\_photo','record\_video','upload\_video','record\_audio','upload\_audio','upload\_document','find\_location','record\_video\_note','upload\_video\_note'

Send MediaGroup [docs](https://github.com/botfire/botfire/wiki/sendMediaGroup-Method)

Edit Message
------------

[](#edit-message)

Edit message

```
bot::id($chat->id)->editMessage('new text')->message_id($msg_id)->send();
```

Edit caption

```
bot::id($chat->id)->editCaption('caption text')->message_id($msg_id)->send();
```

Edit reply markup

```
$k = bot::keyboard();
$k->btn('hello inline button','callback data')->row();

bot::id($chat->id)->editReplyMarkup()->keyboard( $k )->send();
```

Delete message

```
bot::id($chat->id)->deleteMessage()->message_id($msg_id)->send();
```

Receive user messages via webhook
---------------------------------

[](#receive-user-messages-via-webhook)

Get message text

```
$text = bot::text();
```

get message caption

```
$caption = bot::caption();
```

Get callback data

```
$data = bot::data();
```

Get message id

```
$msg_id = bot::message_id();
```

Get all message Object

```
$msg = bot::getMessage();
```

Get All receive Object

```
$get = bot::json(); // object

$get = bot::input(); // text
```

User Type
---------

[](#user-type)

```
if( bot::isUser() ){
  // Receive private messages
}
else if( bot::isGroup() ){
  // Receive from super group
}
else if( ! bot::isGroup() && bot::isGroup(true)  ){
  // Receive from normal group
}
else if( bot::isChannel() ){
  // Receive channel post
}
```

Request Type
------------

[](#request-type)

```
if( bot::getCallback() ){
  // When I click on the inline button

  $data = bot::data();

  //...
}
else {
  // When I send normal text
  // ...
}
```

Receive edited message

```
if (bot::getEditedMessage()) {
  // ...
}

// for channel
if(bot::getEditedChannelPost()){
  // ...
}
```

Answer Callback
---------------

[](#answer-callback)

Answer

```
bot::this()->answerCallback()->send();
```

Answer and send alert

```
bot::this()->answerCallback(true)->text('hello')->send();
```

Sender
------

[](#sender)

Get chat info

```
$chat = bot::chat();
```

Get From

```
$from = bot::from();
```

Keyboard
--------

[](#keyboard)

inline keyboard

```
$k = bot::keyboard();

$k
->btn('btn name 1','data callback 1')
->btn('btn name 2','data callback 2')
->row()
->btnUrl('btn name 3','https://github.com')
->row();

bot::id(bot::chat()->id)->message('...')->keyboard($k)->send();
```

markup keyboard

```
markup($resize_keyboard,$one_time_keyboard,$selective)
```

example

```
$k = bot::keyboard();

$k->markup(true)->btn('button name')->row();

bot::id(bot::chat()->id)->message('...')->keyboard($k)->send();
```

can use autoRow method

```
$k = bot::keyboard();

foreach($list as $item){
  $k->btn($item->name,$item->value);
}

// Creates two buttons in each row
$k->autoRow(2);

bot::this()->message(...)->keyboard($k)->send();

/*
out:
______________
| btn1 | btn2 |
_______________
| btn3 | btn4 |
*/
```

send user contatc

```
$k = bot::keyboard()->markup(true)->contact('Send Phone')->row();

bot::id(bot::chat()->id)->message('Click Send Phone Button')->keyboard($k)->send();
```

Bot Info
--------

[](#bot-info)

```
$info = bot::getMe();

bot::id($chat_id)->message($info)->send();
```

User Profile
------------

[](#user-profile)

```
method : getUserProfilePhotos($user_id,$offset=null,$limit=null)
```

sample

```
$profile = bot::getUserProfilePhotos(bot::chat()->id);
```

### Available message method

[](#available-message-method)

usage

```
bot::this()->photo($file_id)->caption($text)->send();
```

method\*\*\*caption($text)media message captionmessage\_id($msg\_id)inline\_message\_id($inline\_msg\_id)callback\_query\_id($query\_id)parse\_mode($type)Send Markdown or HTMLvcard($vcard)disable\_web\_page\_preview($bool)disable\_notification($bool)live\_period($int)should be between 60 and 86400reply\_to($message\_id)duration($duration)performer($performer)title($title)width($int)height($int)supports\_streaming($bool)thumb($thumb)length($int)latitude($latitude)longitude($longitude)foursquare\_id($foursquare\_id)foursquare\_type($foursquare\_type)Permissions
-----------

[](#permissions)

### setChatPermissions

[](#setchatpermissions)

Use this method to set default chat permissions for all members

```
bot::this()
      ->setChatPermissions()
      ->can_change_info(false)
      ->send();
/*
| methods :
|
| can_send_messages(true|false)
| can_send_media_messages(true|false)
| can_send_polls(true|false)
| can_send_other_messages(true|false)
| can_add_web_page_previews(true|false)
| can_change_info(true|false)
| can_invite_users(true|false)
| can_pin_messages(true|false)
|
*/
```

### restrictChatMember($user\_id,$until\_date=null)

[](#restrictchatmemberuser_iduntil_datenull)

Use this method to restrict a user in a supergroup

```
bot::this()
    ->restrictChatMember(chat_id)
    ->can_send_polls(false)
    ->send();
/*
| methods :
|
| can_send_messages(true|false)
| can_send_media_messages(true|false)
| can_send_polls(true|false)
| can_send_other_messages(true|false)
| can_add_web_page_previews(true|false)
| can_change_info(true|false)
| can_invite_users(true|false)
| can_pin_messages(true|false)
|
*/
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance56

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~96 days

Recently: every ~184 days

Total

20

Last Release

356d ago

Major Versions

0.0.8 → 1.0.02020-10-08

1.1.5 → 2.0.0.beta12025-05-19

PHP version history (2 changes)0.0.1PHP &gt;=7.0.0

2.0.0.beta1PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a97dd5a7e3cc63235bc6fd1637d71f884a1fb7812267047e80c77a547604671d?d=identicon)[parsgit](/maintainers/parsgit)

---

Top Contributors

[![benkhalife](https://avatars.githubusercontent.com/u/31080657?v=4)](https://github.com/benkhalife "benkhalife (353 commits)")

---

Tags

botbot-librarycreate-telegram-botphp-telegram-bottelegramtelegram-bottelegram-bot-apitelegram-bots

### Embed Badge

![Health badge](/badges/botfire-botfire/health.svg)

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

###  Alternatives

[ammadeuss/laravel-html-dom-parser

Laravel wrapper for the PHP Simple HTML DOM Parser package

37365.0k1](/packages/ammadeuss-laravel-html-dom-parser)

PHPackages © 2026

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