phpbotgram

EventContext
in package

Read onlyYes
FinalYes

Readonly DTO carrying the user/chat/thread context extracted from any incoming update by `UserContextMiddleware` (mirror of `aiogram.dispatcher.middlewares.user_context.EventContext`).

Handlers and filters can declare an EventContext $eventContext parameter and the CallableObject reflection step will bind it to the event_context kwarg the middleware injects.

Legacy aliases event_from_user, event_chat, and event_thread_id are written alongside the full context for backward compatibility — see UserContextMiddleware::__invoke.

The businessConnectionId field is intentionally not exposed as a top-level kwarg: upstream's deprecated event_business_connection_id TypedDict key is documentation residue, not populated by the live middleware. Callers must reach into $eventContext->businessConnectionId to read it.

Table of Contents

Properties

$businessConnectionId  : string|null
$chat  : Chat|null
$threadId  : int|null
$user  : User|null

Methods

__construct()  : mixed
chatId()  : int|null
userId()  : int|null

Properties

$businessConnectionId

public string|null $businessConnectionId = null

Methods

__construct()

public __construct([Chat|null $chat = null ][, User|null $user = null ][, int|null $threadId = null ][, string|null $businessConnectionId = null ]) : mixed
Parameters
$chat : Chat|null = null
$user : User|null = null
$threadId : int|null = null
$businessConnectionId : string|null = null

chatId()

public chatId() : int|null
Return values
int|null

userId()

public userId() : int|null
Return values
int|null
On this page

Search results