class Event implements ExtenderInterface

Methods

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

<p>Add a listener to a domain event dispatched by flarum or a flarum extension.</p>

subscribe(string $subscriber)

<p>Add a subscriber for a set of domain events dispatched by flarum or a flarum extension.</p>

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

No description

Details

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

<p>Add a listener to a domain event dispatched by flarum or a flarum extension.</p>

Parameters

string $event
callable|string $listener <p>The listener can either be:</p> <ul> <li>A callback function that accepts an instance of the event as a parameter.</li> <li>The ::class attribute of a class with a public <code>handle</code> method, which accepts an instance of the event as a parameter.</li> <li>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.</li> </ul>

Return Value

Event

Event subscribe(string $subscriber)

<p>Add a subscriber for a set of domain events dispatched by flarum or a flarum extension.</p>

<p>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.</p>

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