PHPackages                             choccybiccy/telegrambot - 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. choccybiccy/telegrambot

ActiveLibrary[API Development](/categories/api)

choccybiccy/telegrambot
=======================

Library for building better Telegram bots

0.2.1(10y ago)1790MITPHP

Since Jul 10Pushed 10y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Telegram Bot API
================

[](#telegram-bot-api)

[![Build Status](https://camo.githubusercontent.com/af3dfe9e03846bbc91971bda46a59b964300dfeab97c143e7630a070eefd3d25/68747470733a2f2f7472617669732d63692e6f72672f63686f63637962696363792f74656c656772616d626f742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/choccybiccy/telegrambot)[![Latest Stable Version](https://camo.githubusercontent.com/9a995a0469f2d1ac6ee9d03d604c43f13afb09b5dee8abb3b24cd84b25c0fff3/68747470733a2f2f706f7365722e707567782e6f72672f63686f63637962696363792f74656c656772616d626f742f762f737461626c652e737667)](https://packagist.org/packages/choccybiccy/telegrambot)[![Latest Unstable Version](https://camo.githubusercontent.com/08a2e5730443398bcbf6f8ddefffaccd81b6edb6fbdba8cce8c6fd57b6ba482b/68747470733a2f2f706f7365722e707567782e6f72672f63686f63637962696363792f74656c656772616d626f742f762f756e737461626c65)](//packagist.org/packages/choccybiccy/telegrambot)[![License](https://camo.githubusercontent.com/a5e59fd56854c11440e3a8da04f0eb11aa80dcd380541ad7ba828edcb6d802ae/68747470733a2f2f706f7365722e707567782e6f72672f63686f63637962696363792f74656c656772616d626f742f6c6963656e73652e737667)](https://packagist.org/packages/choccybiccy/telegrambot)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f8a09130c77ea3507eb31b1a170e85da01d30770fa710964f3d4e3842557745a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63686f63637962696363792f74656c656772616d626f742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/choccybiccy/telegrambot/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/9f0bad4b5be878d5b65cb35c17ca08b19c416962d33bea4774c7bdf55e180452/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38363234626230612d383130342d346531392d613665662d6533343164383237633633622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/8624bb0a-8104-4e19-a6ef-e341d827c63b)

Build better Telegram bots.

Introduction
------------

[](#introduction)

This is a PHP library to help easily build your Telegram bot and it's commands.

Installation
------------

[](#installation)

```
composer require choccybiccy/telegrambot

```

Usage
-----

[](#usage)

### Creating commands

[](#creating-commands)

Let's assume your project is structured like this, and your `src/` folder is namespaced as `App`:

```
public/
    index.php
src/
    Controller/
    Entity/
    Telegram/
        Command/

```

Let's go ahead and create a file called `ExampleCommand.php` in `src/Telegram/Command/`. This command will simply echo whatever the person issuing the command passed as an argument to the command. The user will issue the following command:

```
/example Hello World

```

Now let's create that file:

```
