phpbotgram

CommandStart extends Filter
in package

FinalYes

Convenience filter that matches the `/start` command and (optionally) enforces deep-link semantics. Port of `aiogram.filters.command.CommandStart` (`aiogram/filters/command.py:240-303`).

Why a separate class?

Upstream CommandStart is a subclass of Command that hardcodes the command name to start and adds two extra fields: deep_link (gate on args presence/absence) and deep_link_encoded (Base64-decode the args).

The PHP port keeps the same surface but composes rather than inherits. Subclassing Command would force us to re-declare the same readonly properties via PHP's "promoted property inheritance" dance and would inherit Command::of as a static factory that builds wrong-shaped objects. Composition with a private inner Command (rebuilt per call) avoids both pitfalls — the inner filter handles all the parsing work and CommandStart adds only the deep-link gate.

Phase 4.7 scope

deep_link_encoded (Base64 payload decoding via aiogram.utils.deep_linking.decode_payload) is NOT implemented in this task — that surface lands alongside the deep-linking utility port. The flag itself is therefore not exposed; users who need encoded payloads can decode the raw args in the handler for now.

deepLink tri-state

Mirrors upstream's Optional[bool]:

  • null (default): no gate — args are tolerated but not required. Behaves exactly like Command::of('start').
  • true: args MUST be present. /start payload matches, /start alone rejects. Matches validate_deeplink when deep_link is True.
  • false: args MUST be absent. /start matches, /start payload rejects. Matches validate_deeplink when deep_link is False.

Table of Contents

Properties

$deepLink  : bool|null
$ignoreCase  : bool
$ignoreMention  : bool

Methods

__construct()  : mixed
__invoke()  : array<string, mixed>|false
Evaluate the filter against an update.
all()  : AndFilter
Compose an AND across filters: every child must accept, kwargs cascade. PHP equivalent of Python's `f1 & f2`.
any()  : OrFilter
Compose an OR across filters: the first accepting child wins, no cascade. PHP equivalent of Python's `f1 | f2`.
invertOf()  : InvertFilter
Invert a filter's accept/reject decision. Named `invertOf` rather than `not` because PHP forbids a static and an instance method sharing one name in a single class (the instance-side `$f->not()` convenience may land in a later task).

Properties

$ignoreMention read-only

public bool $ignoreMention = false

Methods

__construct()

public __construct([bool|null $deepLink = null ][, bool $ignoreCase = false ][, bool $ignoreMention = false ]) : mixed
Parameters
$deepLink : bool|null = null
$ignoreCase : bool = false
$ignoreMention : bool = false

__invoke()

Evaluate the filter against an update.

public __invoke(object $event, mixed ...$kwargs) : array<string, mixed>|false
Parameters
$event : object
$kwargs : mixed
Return values
array<string, mixed>|false

all()

Compose an AND across filters: every child must accept, kwargs cascade. PHP equivalent of Python's `f1 & f2`.

public static all(Filter ...$filters) : AndFilter
Parameters
$filters : Filter
Return values
AndFilter

any()

Compose an OR across filters: the first accepting child wins, no cascade. PHP equivalent of Python's `f1 | f2`.

public static any(Filter ...$filters) : OrFilter
Parameters
$filters : Filter
Return values
OrFilter

invertOf()

Invert a filter's accept/reject decision. Named `invertOf` rather than `not` because PHP forbids a static and an instance method sharing one name in a single class (the instance-side `$f->not()` convenience may land in a later task).

public static invertOf(Filter $filter) : InvertFilter
Parameters
$filter : Filter
Return values
InvertFilter
On this page

Search results