Reference

Guide

$page->toArray()

Converts the most important properties to array

$page->toArray(): array

Return type

array

Example

<?php
$array = $page->toArray();
var_dump($array);

With a callback

<?php 
$array = $page->toArray(function ($page) {
  return [
    'id' => $page->id(),
  ];
});
var_dump($array);

Source code

kirby/src/Cms/Page.php#L1421