view->addFunction(new TwigFunction("create_form", function (){ $form = new JsonForm(file_get_contents("form.json")); $form->convertHTML(); $form->render(); })); echo $this->view->render('main/index.html.twig', ['title' => 'Заголовок', 'content' => ""]); } public function exampleAction() { echo "example"; } }