https://github.com/chipslays/litegram
🍃 Simple, flexible library based on events for Telegram Bot Api.
https://github.com/chipslays/litegram
api api-wrapper bot bot-api library telegram telegram-bot
Last synced: 7 months ago
JSON representation
🍃 Simple, flexible library based on events for Telegram Bot Api.
- Host: GitHub
- URL: https://github.com/chipslays/litegram
- Owner: chipslays
- License: mit
- Created: 2021-02-25T11:27:20.000Z (almost 5 years ago)
- Default Branch: v3.x.x
- Last Pushed: 2023-08-08T05:46:43.000Z (over 2 years ago)
- Last Synced: 2025-06-03T11:16:14.225Z (8 months ago)
- Topics: api, api-wrapper, bot, bot-api, library, telegram, telegram-bot
- Language: PHP
- Homepage:
- Size: 1.23 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🍃 Litegram


> v3.x under **wip**, but can usable.

Simple, flexible, modular library based on events for Telegram Bot Api.
Litegram can be used as a regular lightweight library or as a framework with added of plugins.
## ⭐ Features
* Events based (Routing);
* Cache (Redis, Memcached);
* Database (based on Laravel [Database](https://laravel.com/docs/8.x/database) + [Eloquent](https://laravel.com/docs/8.x/eloquent));
* Middlewares;
* Localization (based on [Phrase](https://github.com/chipslays/phrase));
* Sessions (based on Storage plugin);
* Storage (Flat files, Database drivers);
* Talk (Chain Conversation);
* Validation (based on [Respect/Validation](https://respect-validation.readthedocs.io/en/2.0/));
* Stemming;
* Plugins and Components;
* Supports Webhooks & Simple Long-polling (not async);
## 🔩 Installation
Install via Composer:
```bash
$ composer require chipslays/litegram
```
### [📁 Litegram Project](https://github.com/chipslays/litegram-project)
You can use a ready-made and configured [project](https://github.com/chipslays/litegram-project) for a quick start.
See more information [here](https://github.com/chipslays/litegram-project).
1️⃣ Create project:
```bash
composer create-project chipslays/litegram-project SuperDuperBot
```
2️⃣ Change the parameters of the configs and finally type in Terminal:
```bash
php lite webhook:set
```
```bash
php lite migration:up
```
🎉 Congratulation, bot project was set up.
## 💡 Examples
```php
require 'vendor/autoload.php';
$bot = bot($config)->webhook();
$bot->command('start', function () use ($bot) {
$bot->ask('What is your name?', function () use ($bot) {
$name = $bot->payload('message.text');
$bot->reply("👋 Nice to meet you, {$name}!");
});
});
// or
$bot->command('start', 'BotController@startConversation');
$bot->run();
```
> **Note:** Method `ask` work correctly only if `storage` driver set as `file`.
More examples you can see [`here`](https://github.com/chipslays/litegram/tree/v3.x.x/examples).
## 📖 Documentation
Documentation can be found [`here`](https://github.com/chipslays/litegram/tree/v3.x.x/docs).
## [🧩 VS Code Extension](https://marketplace.visualstudio.com/items?itemName=chipslays.litegram-snippets)
Install [Litegram Snippets](https://marketplace.visualstudio.com/items?itemName=chipslays.litegram-snippets) extension for VS Code to increase productivity.
## 🔑 License
Released under the MIT public license. See the enclosed [`LICENSE`](https://github.com/chipslays/litegram/tree/v3.x.x/LICENSE) for details.