Skip to content

Kirby 4.5.0

$kirby->clone()

Creates an instance with the same initial properties

$kirby->clone(array $props = [ ], bool $setInstance = true): Kirby\Cms\App

Parameters

Name Type Default Description
$props array [ ]
$setInstance bool true If false, the instance won't be set globally

Return type

Kirby\Cms\App

This method does not modify the existing $kirby object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Cms\App

Usage

If you don't pass the second argument (or no argument at all), Kirby will set your new cloned instance as the global instance that is also used for handling the current request. Please never call this method like that inside a plugin unless your plugin code executes outside of request handling (e.g. in a command line interface).

In most cases, it's recommended to call the method like this:

$kirby->clone($props, false);