class Event implements ExtenderInterface

Methods

listen(string $event, callable|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.

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

No description

Details

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

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

Parameters

string $event
callable|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.

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

Return Value

Event

See also

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

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

Parameters

Container $container
Extension $extension