PHPackages                             iiiohsen/telegram-bot - 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. iiiohsen/telegram-bot

ActiveLibrary

iiiohsen/telegram-bot
=====================

Duhow PHP Telegram bot

11[1 issues](https://github.com/iiiohsen/Duhow_PHPBot/issues)PHP

Since Feb 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/iiiohsen/Duhow_PHPBot)[ Packagist](https://packagist.org/packages/iiiohsen/telegram-bot)[ RSS](/packages/iiiohsen-telegram-bot/feed)WikiDiscussions my\_branch Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Telegram-PHP
============

[](#telegram-php)

Another library to use Telegram bots with PHP.

- Include the **src/Autoloader.php** file.
- Create a *Telegram\\Bot* object.
- Create a *Telegram\\Receiver* object using the *$bot*.

```
$bot = new Telegram\Bot("11111111:AAAAAAAAAAzzzzzzzzzzzzzzzzzzz", "MyUserBot", "The Name of Bot");
$tg  = new Telegram\Receiver($bot);
```

You can create as many *Bots* and *Receivers* or *Senders* as you want. Using *Receiver* includes a *Sender*.

Usage
=====

[](#usage)

Once the page is loaded (manually or via webhook), you can send or reply the requests.

To send a message to a user or group chat:

```
$tg->send
  ->chat("123456")
  ->text("Hello world!")
->send();
```

To reply a user command:

```
if($tg->text_command("start")){
  $tg->send
    ->text("Hi!")
  ->send();
}
```

To reply a user message:

```
if($tg->text_has("are you alive")){
  $tg->send
    ->text("Yes!")
  ->send();
}
```

**NEW:** To parse a string:

```
if($tg->text_regex("I'm {N:age}") and $tg->words() input->age;
  $str = "So old...";
  if($num < 18){ $str = "You're young!"; }
  $tg->send
    ->text($str)
  ->send();
}elseif($tg->text_regex("My name's {name}")){
  $tg->send
    ->text("Nice to meet you, " .$tg->input->name ."!")
  ->send();
}
```

Send an Inline Keyboard and parse it:

```
if($tg->callback == "but 1"){
  $tg->answer_if_callback(""); // Stop loading button.
  $tg->send
    ->message(TRUE)
    ->chat(TRUE)
    ->text("You pressed the first button!")
  ->edit("text");
}elseif($tg->callback == "but 2"){
  $tg->answer_if_callback("You pressed the second button!", TRUE);
  // Display an alert and stop loading button.
}

if($tg->text_has("matrix") and $tg->words() send
    ->text("Red or blue. You choose.")
    ->inline_keyboard()
      ->row()
        ->button("Red",  "but 1")
        ->button("Blue", "but 2")
      ->end_row()
    ->show()
  ->send();
}
```

Examples
========

[](#examples)

- [Profesor Oak](https://github.com/duhow/ProfesorOak), an assistant for Pokemon GO.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/960b15aeea99c31d69c145f57b5367e18ad155584b479af52574646844ca8cba?d=identicon)[iiiohsen](/maintainers/iiiohsen)

---

Top Contributors

[![iiiohsen](https://avatars.githubusercontent.com/u/8882692?v=4)](https://github.com/iiiohsen "iiiohsen (9 commits)")

### Embed Badge

![Health badge](/badges/iiiohsen-telegram-bot/health.svg)

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

PHPackages © 2026

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