PHPackages                             sloothword/bot-chassis - 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. sloothword/bot-chassis

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

sloothword/bot-chassis
======================

Streamline your Telegram bot development

28[1 issues](https://github.com/sloothword/bot-chassis/issues)PHP

Since Dec 11Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Bot Chassis
===========

[](#bot-chassis)

> **WARNING:** Currently in **ALPHA** state due to:
>
> - quickstart not tested and controller.md not finished
> - the telegram-bot-sdk currently used is no stable version
> - test coverage is low (but slowly growing)
> - integration options for plain php are lacking
> - no argument validation of Chassis API

What?
-----

[](#what)

Adds a fully featured layer upon the basic telegram API (telegram-bot-sdk) to drastically speed up telegram bot development

Why?
----

[](#why)

The telegram-bot-sdk offers a stable API layer for bot development. However, for a fully featured bot many aspects are missing. Instead of jumping into defining the behaviour of the bot, you first need some routing system to handle arbitrary updates, a system to keep track of user conversations and persist associated data, and so on. This package aims to implement this middle layer and enables you to go straight for the fun part!

Feature Overview
================

[](#feature-overview)

- Builds upon telegram-bot-sdk and makes all features easily accessible
- Use controller to easily handle any incoming updates. E.g
- Process commands (`/text`)
- Process any (other) text messages
- Process inline and callback queries
- React to Events like users joining and leaving chat etc.
- Use simple but powerful configuration to wire up and chain Controller
- Integrate with Laravel (and Redis as Backend) out of the box (see below for upcoming options)
- Out-of-the-box persistent storage of metadata
- per conversation (linked to user and chat), message (for callback\_queries), chat or user
- Support for conversations (chain of messages) and helper to control message flow
- Attach handler to your CallbackQueries just as easily

Documentation
=============

[](#documentation)

See below for a [quickstart tutorial](#quickstart)

#### [Configuration](docs/Configuration.md) (WIP)

[](#configuration-wip)

Installation methods, configuration options, framework integration and telegram-bot-sdk integration.

#### Controller (coming soon)

[](#controller-coming-soon)

Routing of updates to Controller, Controller features, persistent MetaData storage

#### API (coming soon)

[](#api-coming-soon)

#### [Telegram Bot Api](https://core.telegram.org/bots)

[](#telegram-bot-api)

A bot can only do as much as is defined in the official telegram bot API.

#### telegram-bot-sdk ([Github](https://github.com/irazasyed/telegram-bot-sdk), [Docs](https://telegram-bot-sdk.readme.io/docs))

[](#telegram-bot-sdk-github-docs)

bot-chassis is build upon telegram-bot-sdk with all features supported. Check the [Migration Guide](docs/Configuration#differences) if you are coming from telegram-bot-sdk.

Feedback, Questions, Contributions
==================================

[](#feedback-questions-contributions)

For all these you can use the [issue tracker](https://github.com/sloothword/bot-chassis/issues).

You could also find me and other bot developers at [Slack PHP Chat](https://phpchat.co/)(Direct message irazasyed for access to #telegram-bot-sdk)

Pull requests are most appreciated if they use PSR-2 Coding Standards, have tests and can be pulled from a feature-branch.

Quickstart
==========

[](#quickstart)

This tutorial uses Laravel and Redis and introduces the basic features `Controller` and `MetaData`.

For more alternatives check the integration guide \[Configuration\].

### Installation

[](#installation)

Install PHP7, Laravel and Redis. Configure Laravel to use your database and redis instance.

Tell composer to use the `telegram-bot-sdk` with `dev` stability (needed until we can use a stable version):

```
composer require irazasyed/telegram-bot-sdk:@dev

```

Add `bot-chassis` to the composer.json:

```
composer require sloothword/bot-chassis

```

Add the LaravelServiceProvider in the app.php:

```
'providers' => [
        ...

        Chassis\Laravel\ChassisServiceProvider::class,

```

Publish the configuration (and migrations)

```
artisan vendor:publish

```

Open `config/chassis.php` and insert your bot credentials.

### Test Run

[](#test-run)

Send a command to the bot (commands `/echo`, `/delayed`, `/double`, see Chassis/Controller/EchoController.php), then call `artisan chassis:handle` to process it.

### Tutorial Bot

[](#tutorial-bot)

This tutorial bot will have three functions:

- The bot adds every integer messages in the chat.
- `/reset` sets the counter back to 0
- `/set` sets the counter to the next sent integer

### Controller

[](#controller)

Create a new Controller under your application namespace and structure.

```
