Reference

Template engine

/site/plugins/template-engine/index.php
class CustomTemplate extends Kirby\Cms\Template {

}

Kirby::plugin('my/template', [
    'components' => [
        'template' => function (App $kirby, string $name, string $contentType = null) {
            return new CustomTemplate($name, $contentType);
        }
    ]
]);