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

ActiveLibrary

atanych/telegram-bot
====================

PHP telegram bot (it is fork from longman/telegram-bot)

0.21.0(10y ago)1117MITPHPPHP &gt;=5.4.0

Since Jun 26Pushed 7y ago2 watchersCompare

[ Source](https://github.com/atanych/php-telegram-bot)[ Packagist](https://packagist.org/packages/atanych/telegram-bot)[ Docs](https://github.com/akalongman/php-telegram-bot)[ RSS](/packages/atanych-telegram-bot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (26)Used By (0)

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

[](#php-telegram-bot)

[![Join the chat at https://gitter.im/akalongman/php-telegram-bot](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/akalongman/php-telegram-bot?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/797ae90139fbb40297e10490b45ee5114917354b73fc42e5d37f2f73822c5a2b/68747470733a2f2f7472617669732d63692e6f72672f616b616c6f6e676d616e2f7068702d74656c656772616d2d626f742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/akalongman/php-telegram-bot)[![Latest Stable Version](https://camo.githubusercontent.com/3a2e9084d9f62dd0bff4b67e27a11c3ddedba8b7b400ea2ae0b2945bea017d8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4c6f6e676d616e2f74656c656772616d2d626f742e737667)](https://packagist.org/packages/longman/telegram-bot)[![Total Downloads](https://camo.githubusercontent.com/2e76cf3d6a8d11e50fbcf01e0c07cdc3f7ad01101cae0831df17e9a970405374/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4c6f6e676d616e2f74656c656772616d2d626f742e737667)](https://packagist.org/packages/longman/telegram-bot)[![Downloads Month](https://camo.githubusercontent.com/04f4263968e03f6066f8b85b18b438e4c40e0a027cc42dd144937158d90ece2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f4c6f6e676d616e2f74656c656772616d2d626f742e737667)](https://packagist.org/packages/longman/telegram-bot)[![License](https://camo.githubusercontent.com/855513c989ea504a9fe4e868e184f125bcd5535eee19a90e556ad0e53fb4e197/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f4c6f6e676d616e2f74656c656772616d2d626f742e737667)](https://packagist.org/packages/longman/telegram-bot)

A Telegram Bot based on the official [Telegram Bot API](https://core.telegram.org/bots/api)

### Introduction

[](#introduction)

This is a pure php Telegram Bot, fully extensible via plugins. Telegram recently announced official support for a [Bot API](https://telegram.org/blog/bot-revolution) allowing integrators of all sorts to bring automated interactions to the mobile platform. This Bot aims to provide a platform where one could simply write a plugin and have interactions in a matter of minutes. The Bot can:

- retrive update with webhook and getUpdate methods.
- supports all types and methods according to Telegram API (2015 October 8).
- handle commands in chat with other bots.

It is ready for the channels support.

Instructions
------------

[](#instructions)

### Create your first bot

[](#create-your-first-bot)

1. Message @botfather  with the following text: `/newbot`If you don't know how to message by username, click the search field on your Telegram app and type `@botfather`, you should be able to initiate a conversation. Be careful not to send it to the wrong contact, because some users has similar usernames to `botfather`.

    [![botfather initial conversation](https://camo.githubusercontent.com/c41f7100347d9e629a4d3211d836fcd02d749ddd2cc329a8d83c088f517ceca2/687474703a2f2f692e696d6775722e636f6d2f614932366978522e706e67)](https://camo.githubusercontent.com/c41f7100347d9e629a4d3211d836fcd02d749ddd2cc329a8d83c088f517ceca2/687474703a2f2f692e696d6775722e636f6d2f614932366978522e706e67)
2. @botfather replies with `Alright, a new bot. How are we going to call it? Please choose a name for your bot.`
3. Type whatever name you want for your bot.
4. @botfather replies with `Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.`
5. Type whatever username you want for your bot, minimum 5 characters, and must end with `bot`. For example: `telesample_bot`
6. @botfather replies with:

    Done! Congratulations on your new bot. You will find it at telegram.me/telesample\_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands.

    Use this token to access the HTTP API: **123456789:AAG90e14-0f8-40183D-18491dDE**

    For a description of the Bot API, see this page:
7. Note down the 'token' mentioned above.
8. Type `/setprivacy` to @botfather.

    [![botfather later conversation](https://camo.githubusercontent.com/f5c5019b8512280ea872002f6b5a076207640b0568c40d8cafdf8de60a7658d2/687474703a2f2f692e696d6775722e636f6d2f745744567668342e706e67)](https://camo.githubusercontent.com/f5c5019b8512280ea872002f6b5a076207640b0568c40d8cafdf8de60a7658d2/687474703a2f2f692e696d6775722e636f6d2f745744567668342e706e67)
9. @botfather replies with `Choose a bot to change group messages settings.`
10. Type `@telesample_bot` (change to the username you set at step 5 above, but start it with `@`)
11. @botfather replies with

    'Enable' - your bot will only receive messages that either start with the '/' symbol or mention the bot by username. 'Disable' - your bot will receive all messages that people send to groups. Current status is: ENABLED
12. Type `Disable` to let your bot receive all messages sent to a group. This step is up to you actually.
13. @botfather replies with `Success! The new status is: DISABLED. /help`

### Require this package with Composer

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

Install this package through [Composer](https://getcomposer.org/). Edit your project's `composer.json` file to require `longman/telegram-bot`.

Create *composer.json* file:

```
{
    "name": "yourproject/yourproject",
    "type": "project",
    "require": {
        "php": ">=5.4.0",
        "longman/telegram-bot": "*"
    }
}
```

And run composer update

**Or** run a command in your command line:

```
composer require longman/telegram-bot

```

### Choose how to retrieve Telegram updates

[](#choose-how-to-retrieve-telegram-updates)

The bot can handle updates with **webhook** or **getUpdate** method:

WebhookgetUpdateDescriptionTelegram send the update directy to your hostYou have to fetch Telegram updatesHost with httpsRequiredNot requiredMysqlNot requiredRequiredWebhook installation
--------------------

[](#webhook-installation)

You need server with https and composer support. You must set a [WebHook](https://core.telegram.org/bots/api#setwebhook). Create *set.php* (just edit *example-set.php*) and put into it:

```
