Skip to content

Kirby 3.8.2

$kirby->render()

Returns the Response object for the current request

$kirby->render(string $path = null, string $method = null): Kirby\Http\Response

Parameters

Name Type Default
$path string null
$method string null

Return type

Kirby\Http\Response

Parent class

Kirby\Cms\App

Disabling the render method

$kirby->render() can be disabled temporarily by setting

$_ENV['KIRBY_RENDER'] = false;

This needs to be set before $kirby->render() is called.

As an example, this is used by the Kirby CLI to load the index.php without getting any output. This way, the CLI can access the correct $kirby instance with all custom roots and options.

If one of your independent PHP scripts need access to the $kirby instance in a similar way, you can require the index.php like this …

/example.php
<?php

$_ENV['KIRBY_RENDER'] = false;

// Kirby will not render anything
require __DIR__ . '/index.php';

// You get full access to the $kirby object
// with all custom settings
dump($kirby);