1. Go to this page and download the library: Download m1lkin/looksmaxxer 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/ */
m1lkin / looksmaxxer example snippets
use Looksmaxxer\Bot;
use Looksmaxxer\Models\Update;
use Looksmaxxer\Client;
use Looksmaxxer\Models\Keyboard\InlineKeyboard;
use Looksmaxxer\Models\Keyboard\Button;
use Looksmaxxer\Builders\MessageBuilder;
$bot = new Bot('TOKEN');
// 1. Отправляем кнопку запроса
$bot->onCommand('start', function(Update $update, Client $client) {
$kb = InlineKeyboard::create()
->addRow(Button::requestGeoLocation('Где я?', quick: true));
$client->sendMessage(
MessageBuilder::create(chatId: $update->chatId)
->text('Нажми на кнопку ниже:')
->inlineKeyboard($kb)
);
});
// 2. Обрабатываем ответ
$bot->onLocation(function(Update $update, Client $client) {
$location = $update->message->getLocation();
echo "Широта: {$location->latitude}, Долгота: {$location->longitude}";
});
// Запуск (Long Polling для тестов)
$bot->start();