phpbotgram

Flag
in package
implements Stringable

Read onlyYes
FinalYes

Per-handler metadata tag, mirror of upstream `aiogram.dispatcher.flags.Flag` (`@dataclass(frozen=True)`). Two roles:

  1. Value objectname/value carried in a list on HandlerObject, read by middleware/filters at dispatch time (Flags::getFlag($h, 'chat_action')?->value).
  2. Repeatable PHP attribute — stack any number of #[Flag('name', $value)] on a handler method, function, or closure literal; Flags::extractFlags() reads them back via reflection.

Booleans are the common case (#[Flag('admin_only')]), so value defaults to true and __toString() renders the name alone for grep-friendly log output. Non-boolean values render as name=value via var_export() so quoting survives the round-trip.

Attributes
#[Attribute]
\Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION | \Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE

Table of Contents

Interfaces

Stringable

Properties

$name  : string
$value  : mixed

Methods

__construct()  : mixed
__toString()  : string

Properties

$name

public string $name

$value

public mixed $value = true

Methods

__construct()

public __construct(string $name[, mixed $value = true ]) : mixed
Parameters
$name : string
$value : mixed = true

__toString()

public __toString() : string
Return values
string
On this page

Search results