Skip to content

Kirby 4.5.0

$kirby->collection()

Returns a specific user-defined collection by name. All relevant dependencies are automatically injected

$kirby->collection(string $name, array $options = [ ]): Kirby\Toolkit\Collection|null

Parameters

Name Type Default
$name * string
$options array [ ]

Return type

Kirby\Toolkit\Collection|null

Parent class

Kirby\Cms\App

Example

Call a predefined collection by key:

$articles = $kirby->collection('blog');
dump($articles);