This is documentation for Kohana v2.3.x.
Status | Stub |
---|---|
Todo | What events are, how events work, running, adding, using custom |
Todo | Move stuff from core:event |
See Event for information on adding, running, removing and using custom events.
Kohana events consist of a name and callback. Names usually include a prefix with the name 1), but are not required to. All of the core events are prefixed as system.name
.
The following events are defined in the Kohana core files. The pre-defined actions for these events are added in Kohana::setup.
Called immediately after hooks are loaded. This is the earliest attachable event. Nothing is attached to this event by default. Hooks are loaded before this point.
Processes the URL and does routing. Calls Router::find_uri and Router::setup by default.
Controller locating and initialization. A controller object will be created, as an instance of Kohana. Calls Kohana::instance by default.
Triggered after all routing is done so interventions in routing can be done here. If Router::$controller is empty after this event a 404 is triggered.
Called when a page cannot be found. Calls Kohana::show_404 by default.
Called within system.execute, after the controller file is loaded, but before an object is created.
Called within system.execute, after the controller constructor has been called. Kohana::instance will return the controller at this point, and views can be loaded. Controller methods have not been called yet.
Called within system.execute, after the controller object is created. Kohana::instance will return the controller at this point, and views can be loaded.
Called just before the global output buffer is closed, before any content is displayed. Writing cookies is not possible after this point, and Session data will not be saved.
Displays the output that Kohana has generated. Views can be loaded, but headers have already been sent. The rendered output can be manipulated as Event::$data.
Last event to run, just before PHP starts to shut down. Runs the Kohana::shutdown method by default.
Called within Kohana::log, useful if you want to send an email when certain events are logged or store log messages in a different location.
Called within url::redirect, useful to detect that the system is about to perform a redirect.
Hooks are included early in Kohana and can be used, e.g., to execute code before controllers are loaded so you can check for authentication early on in processing and thereby reduce server resources. Events and hooks go hand in hand: hooks allow you to attach code to events. See for more information the Hooks page.