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

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

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

The listener can either be: - a callback function - the class attribute of a class with a public <code>handle</code> 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

Parameters

string $event
callable|string $listener

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

See also

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

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

Parameters

Container $container
Extension $extension