PHP code example of boshurik / telegram-bot-bundle
1. Go to this page and download the library: Download boshurik/telegram-bot-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
boshurik / telegram-bot-bundle example snippets
use TelegramBot\Api\BotApi;
public function __construct(private BotApi $api)
use BoShurik\TelegramBotBundle\Telegram\BotLocator;
use TelegramBot\Api\BotApi;
public function foo(BotLocator $botLocator)
{
/** @var BotApi $api */
$api = $botLocator->get('first');
}
use TelegramBot\Api\BotApi;
public function __construct(private BotApi $firstBotApi)
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new BoShurik\TelegramBotBundle\BoShurikTelegramBotBundle,
);
// ...
}
php
/**
* @param UpdateEvent $event
*/
public function onUpdate(UpdateEvent $event)
{
$update = $event->getUpdate();
$message = $update->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.