set

Fires when the application is ready.

Table of Contents
  1. Description
  2. Example

Description

This hook fires when the application is ready. That is, when the default response status, MIME type, and time zone are declared, and when all the extensions and tasks are loaded.

Example

$start = microtime(true);
Hook::set('set', function () use ($start) {
    $t = microtime(true) - $start;
    Hook::set('content', function ($content) use ($t) {
        if (!$content || '</html>' !== substr($content, -7)) {
            return $content;
        }
        return $content . '<!-- Application ready in ' . $t . ' second' . (1.0 === $t ? "" : 's') . '. -->';
    }, 1000);
});

body

Modifies the body part of the current HTML response.

content

Modifies the current HTML response.

enter

Modifies the current HTTP response headers.

exit

Fires after script execution ends.

get

Fires when the application is ready.

head

Modifies the head part of the current HTML response.

let

Fires when the application finishes rendering.

route

Sets the response body.

set

Fires when the application is ready.