miraliog / pelegram
PHP Library for Telegtram, pelegram
v1.0.5
2026-08-29 14:37 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^8.0
README
A lightweight PHP wrapper for the Telegram Bot API.
pelegram provides a simple interface for building Telegram bots with PHP, including API methods, update handling, routing, and convenient access to update data.
Requirements
- PHP 8.1+
- Guzzle HTTP 7.x
Installation
Install pelegram with Composer:
composer require miraliog/pelegram
Quick Example
<?php require 'vendor/autoload.php'; use miraliog\pelegram\Bot; use miraliog\pelegram\Router; use miraliog\pelegram\Update; $bot = new Bot('YOUR_BOT_TOKEN'); $router = new Router(); $router->onCommand('start', function (Bot $bot, Update $update) { $bot->sendMessage( $update->chatId(), 'Hello from pelegram!' ); }); $update = new Update( json_decode(file_get_contents('php://input'), true) ); $router->dispatch($bot, $update);
That's it.
pelegram is designed to stay close to the Telegram Bot API while keeping bot code clean and simple.
License
MIT