class Event implements ExtenderInterface

Methods

listen(string $event, callable|array|string $listener)

Add a listener to a domain event dispatched by flarum or a flarum extension.

subscribe(string $subscriber)

Add a subscriber for a set of domain events dispatched by flarum or a flarum extension.

void
extend( Container $container, Extension|null $extension = null)

No description

Details

Event listen(string $event, callable|array|string $listener)

Add a listener to a domain event dispatched by flarum or a flarum extension.

Parameters

string $event : Name of the event, can be the ::class attribute of the event class.
callable|array|string $listener The listener can either be: - A callback function that accepts an instance of the event as a parameter. - The ::class attribute of a class with a public `handle` method, which accepts an instance of the event as a parameter. - An array, where the first argument is an object or class name, and the second argument is the method on the first argument that should be executed as the listener. A class name is resolved through the container, so the method does not have to be static.

Return Value

Event

Event subscribe(string $subscriber)

Add a subscriber for a set of domain events dispatched by flarum or a flarum extension.

Event subscribers are classes that may subscribe to multiple events from within the subscriber class itself, allowing you to define several event handlers within a single class.

Parameters

string $subscriber : The ::class attribute of the subscriber class.

Return Value

Event

See also

https://laravel.com/docs/13.x/events#writing-event-subscribers

void extend( Container $container, Extension|null $extension = null)

Parameters

Container $container
Extension|null $extension

Return Value

void