Skip to main content

Some secrets for a Simple Telegram Bot in PHP

<?php $botToken = “123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11”; $botAPI = “” . $botToken; $update = file_get_contents(‘php://input’); $update = json_decode($update, TRUE); if (!$update) { exit; } $message = isset($update[‘message’]) ? $update[‘message’] : “”; where$botToken is the bot token, generated by BotFather for your bot and used to register the bot on the Webhook service$botAPI is the URL used to send commands to […]

Asynchronous and parallel PHP

The spatie/async library provides a small and easy wrapper around PHP’s PCNTL extension. It allows running of different processes in parallel, with an easy-to-use API. Installation You can install the package via composer: composer require spatie/async Usage use Spatie\Async\Pool; $pool = Pool::create(); foreach ($things as $thing) { $pool->add(function () use ($thing) { // Do a […]