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

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

php-telegram-bot/telegram-bot-manager
=====================================

PHP Telegram Bot Manager

2.1.0(2y ago)22014.5k67[1 PRs](https://github.com/php-telegram-bot/telegram-bot-manager/pulls)MITPHPPHP ^8.0

Since Aug 20Pushed 2y ago19 watchersCompare

[ Source](https://github.com/php-telegram-bot/telegram-bot-manager)[ Packagist](https://packagist.org/packages/php-telegram-bot/telegram-bot-manager)[ Docs](https://github.com/php-telegram-bot/telegram-bot-manager)[ Fund](https://github.com/php-telegram-bot/telegram-bot-manager#donate)[ Fund](https://ko-fi.com/phptelegrambot)[ RSS](/packages/php-telegram-bot-telegram-bot-manager/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (26)Used By (0)

PHP Telegram Bot Manager
========================

[](#php-telegram-bot-manager)

[![Join the bot support group on Telegram](https://camo.githubusercontent.com/471c1499869f264b2640d365d2b92f8f0461afb6d9eef50960e862b37c08b93f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74656c656772616d2d405048505f5f54656c656772616d5f5f426f745f5f537570706f72742d3634363539642e737667)](https://telegram.me/PHP_Telegram_Bot_Support)[![Donate](https://camo.githubusercontent.com/e529dd950cc97c0a203bb51d44eb58499d67bb2a4e7dde44b6a895254abe3fec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539322539392d446f6e617465253230253246253230537570706f727425323055732d626c75652e737667)](#donate)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6b75f333ba621f68ffe564d4ba350cb85ab46634c48a6bf36c04c9033f97573d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7068702d74656c656772616d2d626f742f74656c656772616d2d626f742d6d616e616765722e737667)](https://scrutinizer-ci.com/g/php-telegram-bot/telegram-bot-manager/?branch=master "Code quality on Scrutinizer")[![Codecov](https://camo.githubusercontent.com/c5571fb7406d01a994a3e1761e55123fe18596807db9fd1b683e6e95375341d8/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7068702d74656c656772616d2d626f742f74656c656772616d2d626f742d6d616e616765722e737667)](https://codecov.io/gh/php-telegram-bot/telegram-bot-manager "Code coverage on Codecov")[![Tests Status](https://github.com/php-telegram-bot/telegram-bot-manager/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/php-telegram-bot/telegram-bot-manager/workflows/tests.yml "Tests status on GitHub Actions")

[![Latest Stable Version](https://camo.githubusercontent.com/9e73c67d7e28e3f9607530a9ceccba8406aaa3f2ad7d14c44629756a74efc619/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d74656c656772616d2d626f742f74656c656772616d2d626f742d6d616e616765722e737667)](https://github.com/php-telegram-bot/telegram-bot-manager "PHP Telegram Bot Manager on GitHub")[![Dependencies](https://camo.githubusercontent.com/c18997f20ab9e6a98e61224314759dfe37eb6823f328a7b7b965319b8f495731/68747470733a2f2f746964656c6966742e636f6d2f6261646765732f6769746875622f7068702d74656c656772616d2d626f742f636f72653f7374796c653d666c6174)](https://tidelift.com/subscription/pkg/packagist-php-telegram-bot-telegram-bot-manager?utm_source=packagist-php-telegram-bot-telegram-bot-manager&utm_medium=referral&utm_campaign=readme "Support us on Tidelift")[![Total Downloads](https://camo.githubusercontent.com/651e45903cb8dbf45e7db23fcd9fc5dc98fc9873145826d17745102e5a61a12b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d74656c656772616d2d626f742f74656c656772616d2d626f742d6d616e616765722e737667)](https://packagist.org/packages/php-telegram-bot/telegram-bot-manager "PHP Telegram Bot Manager on Packagist")[![License](https://camo.githubusercontent.com/8c5c942656569fb8e5e298511fe1730de8e09187389989d2a737a7f548390220/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068702d74656c656772616d2d626f742f74656c656772616d2d626f742d6d616e616765722e737667)](https://github.com/php-telegram-bot/telegram-bot-manager/blob/master/LICENSE "PHP Telegram Bot Manager license")

This project builds on top of [PHP Telegram Bot](https://github.com/php-telegram-bot/core "PHP Telegram Bot on GitHub") and as such, depends on it!

The main purpose of this mini-library is to make the interaction between your webserver and Telegram easier. I strongly suggest your read the PHP Telegram Bot [instructions](https://github.com/php-telegram-bot/core#instructions "PHP Telegram Bot instructions on GitHub") first, to understand what this library does exactly.

Installation and usage is pretty straight forward:

### Require this package with [Composer](https://getcomposer.org/ "Composer")

[](#require-this-package-with-composer)

```
composer require php-telegram-bot/telegram-bot-manager:^2.1
```

**NOTE:** This will automatically also install [PHP Telegram Bot](https://github.com/php-telegram-bot/core "PHP Telegram Bot on GitHub") into your project (if it isn't already).

**Advanced:** Due to the fact that the core library is not a stable version yet, this project is partly locked to the core version, to ensure reliable functioning.

It is possible however, to override the core version that this library requires:

```
"require": {
    "php-telegram-bot/telegram-bot-manager": "^2.1",
    "longman/telegram-bot": "dev-master as 0.81"
}
```

This example will pull the master version of the core library, making it appear to be version 0.81, which then satisfies the requirement.

### Performing actions

[](#performing-actions)

What use would this library be if you couldn't perform any actions?!

There are a few parameters available to get things rolling:

ParameterDescriptions**s**ecret: This is a special secret value defined in the main `manager.php` file.This parameter is required to call the script via browser!a**a**ction: The actual action to perform. (handle (default), webhookinfo, cron, set, unset, reset)**handle** executes the `getUpdates` method; **webhookinfo** to get result from `getWebhookInfo`, **cron** executes cron commands; **set** / **unset** / **reset** the webhook.l**l**oop: Number of seconds to loop the script for (used for getUpdates method).This would be used mainly via CLI, to continually get updates for a certain period.i**i**nterval: Number of seconds to wait between getUpdates requests (used for getUpdates method, default is 2).This would be used mainly via CLI, to continually get updates for a certain period, every **i** seconds.g**g**roup: Commands group for cron (only used together with `cron` action, default group is `default`).Define which group of commands to execute via cron. Can be a comma separated list of groups.#### via browser

[](#via-browser)

Simply point your browser to the `manager.php` file with the necessary **GET** parameters:

- `http://example.com/manager.php?s=&a=&l=&i=`

**Webhook**

Set, unset and reset the webhook:

- `http://example.com/manager.php?s=super_secret&a=set`
- `http://example.com/manager.php?s=super_secret&a=unset`
- `http://example.com/manager.php?s=super_secret&a=reset` (unset &amp; set combined)

**getUpdates**

Handle updates once:

- `http://example.com/manager.php?s=super_secret&a=handle` or simply
- `http://example.com/manager.php?s=super_secret` (`handle` action is the default)

Handle updates for 30 seconds, fetching every 5 seconds:

- `http://example.com/manager.php?s=super_secret&l=30&i=5`

**cron**

Execute commands via cron:

- `http://example.com/manager.php?s=super_secret&a=cron&g=maintenance` or multiple groups
- `http://example.com/manager.php?s=super_secret&a=cron&g=maintenance,cleanup`

#### via CLI

[](#via-cli)

When using CLI, the secret is not necessary (since it could just be read from the file itself).

Call the `manager.php` file directly using `php` and pass the parameters:

- `$ php manager.php a= l= i=`

**Webhook**

Set, unset and reset the webhook:

- `$ php manager.php a=set`
- `$ php manager.php a=unset`
- `$ php manager.php a=reset` (unset &amp; set combined)

**getUpdates**

Handle updates once:

- `$ php manager.php a=handle` or simply
- `$ php manager.php` (`handle` action is the default)

Handle updates for 30 seconds, fetching every 5 seconds:

- `$ php manager.php l=30 i=5`

**cron**

Execute commands via cron:

- `$ php manager.php a=cron g=maintenance` or multiple groups
- `$ php manager.php a=cron g=maintenance,cleanup`

### Create the manager PHP file

[](#create-the-manager-php-file)

You can name this file whatever you like, it just has to be somewhere inside your PHP project (preferably in the root folder to make things easier). (Let's assume our file is called `manager.php`)

Let's start off with a simple example that uses the webhook method:

```
