Class event

class event

Registers and fires events (hooks)

listen($event, $handler)

(static) Sets a new function to run when an event is triggered later.

Parameters:
  • $event (string) – The event name.
  • $handler (function) – The function to call.
fire(string $event[, Array $params])

(static) Fires an event and calls all handling functions.

Parameters:
  • $event (string) – The event name.
  • $params (function) – (optional) Parameters to send to handlers.
get(string $event, mixed $default[, Array $params])

(static) Fires an event and calls the handling function (only one should be set). Return the result of the handler.

Parameters:
  • $event (string) – The event name.
  • $default (mixed) – The value to return if there was no handler called.
  • $params (function) – (optional) Parameters to send to handler.