Skip to content
docs

Subscribe

Marks a class or method as an event subscriber. Can be applied to: - Classes: The class becomes a listener, method specified by $method parameter - Methods: The method becomes the event handler

Subscribe::__construct()

public function __construct(string $event, ?string $method = null, Milpa\app\Enums\ListenerPriority|int $priority = Milpa\app\Enums\ListenerPriority::NORMAL, ?Milpa\app\Enums\DispatcherType $dispatcher = null):

Parameters

Parámetros de __construct()
NombreTipoDescripción
$eventstringEvent name or class to subscribe to
$method(string | null)Handler method name (required for class-level)
$priority(int | ListenerPriority)Execution priority (higher = earlier)
$dispatcher(DispatcherType | null)Target event bus (DispatcherType::SYMFONY or DispatcherType::MILPA)

Subscribe::getPriority()

public function getPriority(): int

Get the numeric priority value.