PHPackages                             smoqadam/php-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. [API Development](/categories/api)
4. /
5. smoqadam/php-telegram-bot

ActiveLibrary[API Development](/categories/api)

smoqadam/php-telegram-bot
=========================

wrapper class for tg bot api

v1.0(8y ago)211846MITPHPPHP &gt;=5.3.0

Since Dec 7Pushed 8y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9d9b1369dc0e325953aff24f4c4424e8b8b3574f1e723ca8c1fc62b889ba8198/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736d6f716164616d2f7068702d74656c656772616d2d626f742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/smoqadam/php-telegram-bot/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/14188b444ab8113fe5131ba27f939c16c38e488baa0d63c905d0e28ecd04b0bd/68747470733a2f2f7777772e636f646163792e636f6d2f70726f6a6563742f62616467652f3730303864633064323131633462626139356535623331353337373032303530)](https://www.codacy.com/app/phpro-ir/php-telegram-bot)

php-telegram-bot
================

[](#php-telegram-bot)

A wrapper class for Telegram Bot API

Install
-------

[](#install)

create composer.json :

```
{
    "require": {
        "smoqadam/php-telegram-bot": "v1.0"
    }
}

```

`$ composer install`

How to use:
-----------

[](#how-to-use)

`Smoqadam\Telegram` is a wrapper around Telegram bot API. After you instantiate `Telegram` object, you can register callbacks on the updates you receive and then respond accordingly.

**Register callbacks:** Use following functions:

- `cmd()`, all normal messages
- `inlineQuery()`

**API Methods:**The available methods are almost same of official Telegram API (for now the wrapper does not natively handles games and messages update):

- `sendMessage()`, `getMe()`, `forwardMessage()`, `sendPhoto()`, `sendVideo()`, `sendSticker()`, `sendLocation()`, `sendDocument()`, `sendAudio()`, `sendChatAction()`, `getUserProfilePhotos()`, `answerInlineQuery()`

**Getting current update:**The current update is stored in the property `Telegram::result` (that is an object).

**Inline Result helper:**To facilitate the creation of Inline Bot there are some helper classes under namespace `InlineQuery\Result`:

- `Article`

**Keyboards helper:**Also the same with keyboards; namespace is `Keyboard`:

- `Standard`, classic keyboard
- `Remove`, remove custom keyboard and show letter-keyboard
- `Inline`, inline keyboard

**Use Keyboard:**Use the keyboard is pretty simple with helpers, after you instantiate keyboard (`Standard` or `Inline`) you use:

- `addButton()`
- `addRow()`

*Note:* These methods are chainable.

Example
-------

[](#example)

**Using long polling:**

```
