Skip to content

Kirby 4.1.2

Array

PHP arrays will automatically be converted to a JSON response

/site/config/config.php
return [
  'routes' => [
    [
      'pattern' => 'custom/response',
      'action'  => function () {
        return [
          'status' => 'ok',
          'data'   => ['foo' => 'bar']
        ];
      }
    ]
  ]
];