chipslays / litegram
Simple, flexible, modular library for Telegram Bot Api.
Requires
- php: >=7.4
- ext-curl: *
- chipslays/collection: ^1.0
- chipslays/event: 1.0.*
- chipslays/pastly-api: ^1.1
- chipslays/phrase: ^1.0
- chipslays/sauce: ^1.0
- illuminate/database: ^8||^9||^10
- illuminate/pagination: ^8||^9||^10
- opis/closure: ^3.6
- respect/validation: ^2.2
- wamania/php-stemmer: 2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- v3.x-dev
- 3.0.17
- 3.0.16
- 3.0.15
- 3.0.14
- 3.0.13
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- v2.x-dev
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-master
This package is auto-updated.
Last update: 2025-01-08 08:49:32 UTC
README
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 + Eloquent);
- Middlewares;
- Localization (based on Phrase);
- Sessions (based on Storage plugin);
- Storage (Flat files, Database drivers);
- Talk (Chain Conversation);
- Validation (based on Respect/Validation);
- Stemming;
- Plugins and Components;
- Supports Webhooks & Simple Long-polling (not async);
🔩 Installation
Install via Composer:
$ composer require chipslays/litegram
📁 Litegram Project
You can use a ready-made and configured project for a quick start.
See more information here.
1️⃣ Create project:
composer create-project chipslays/litegram-project SuperDuperBot
2️⃣ Change the parameters of the configs and finally type in Terminal:
php lite webhook:set
php lite migration:up
🎉 Congratulation, bot project was set up.
💡 Examples
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 ifstorage
driver set asfile
.
More examples you can see here
.
📖 Documentation
Documentation can be found here
.
🧩 VS Code Extension
Install Litegram Snippets extension for VS Code to increase productivity.
🔑 License
Released under the MIT public license. See the enclosed LICENSE
for details.