The Telegram bot library that doesn't drive you nuts
Taking advantage of the PHP 8.2 features, this framework and tries to make the speed, scalability and flexibility of use its strength, allowing to quickly make simple bots, but at the same time, it provides more advanced features to handle even the most complicated flows.
<?php
use SergiX44\Nutgram\Nutgram;
$bot = new Nutgram($_ENV['TOKEN']);
$bot->onCommand('start', function(Nutgram $bot) {
$bot->sendMessage('Ciao!');
});
$bot->onText('My name is {name}', function(Nutgram $bot, string $name) {
$bot->sendMessage("Hi $name");
});
$bot->run();