PHP code example of webtolk / max
1. Go to this page and download the library: Download webtolk/max 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/ */
webtolk / max example snippets
declare(strict_types=1);
use Joomla\Http\HttpFactory as JoomlaHttpFactory;
use Laminas\Diactoros\RequestFactory;
use Laminas\Diactoros\StreamFactory;
use Webtolk\Max\Config\MaxConfig;
use Webtolk\Max\Max;
use Webtolk\Max\Payload\NewMessageBody;
ts()->me();
echo 'Bot ID: ' . $bot->getId() . PHP_EOL;
echo 'Username: ' . $bot->getUsername() . PHP_EOL;
$message = $max->messages()->sendToChat(
123456,
NewMessageBody::text('Привет из MAX SDK')
);
echo 'Message text: ' . ($message->getBody()?->getText() ?? '') . PHP_EOL;