<?php
require_once 'vendor/autoload.php';
use FFI\TDLib\TDLib;
// Создаем экземпляр класса FFITdLib
$tdlib = new TDLib();
// Устанавливаем параметры для авторизации
$api_id = 'YOUR_API_ID';
$api_hash = 'YOUR_API_HASH';
$phone_number = 'YOUR_PHONE_NUMBER';
// Выполняем авторизацию
$tdlib->send([
    '@type' => 'setTdlibParameters',
    'parameters' => [
        'api_id' => $api_id,
        'api_hash' => $api_hash,
        'use_test_dc' => false,
        'database_directory' => 'tdlib-db',
        'files_directory' => 'tdlib-files',
        'use_file_database' => false,
        'use_chat_info_database' => false,
        'use_message_database' => false,
        'use_secret_chats' => false,
        'api_key' => '',
        'system_language_code' => 'en',
        'device_model' => 'unknown',
        'system_version' => 'unknown',
        'application_version' => '1.0',
        'enable_storage_optimizer' => true,
        'ignore_file_names' => false,
    ],
]);
$tdlib->send([
    '@type' => 'checkDatabaseEncryptionKey',
    'key' => '',
]);
$tdlib->send([
    '@type' => 'setAuthenticationPhoneNumber',
    'phone_number' => $phone_number,
]);
// Получаем код авторизации
$code = readline('Enter the code: ');
$tdlib->send([
    '@type' => 'checkAuthenticationCode',
    'code' => $code,
]);
// Выполняем запрос getChatStatistics
$chat_id = 'CHAT_ID';
$result = $tdlib->send([
    '@type' => 'getChatStatistics',
    'chat_id' => $chat_id,
    'is_dark' => false,
]);
print_r($result);