<?php
use Laminas\Form\Factory;
use Laminas\Form\Element\Text;
use Laminas\Form\Element\Submit;
use Laminas\Form\Element\Radio;
use Laminas\Form\View\Helper;
use Laminas\View\Renderer\ConsoleRenderer;
$factory = new Factory();
// Create Form elements
$form = $factory->createForm([]);
$textElement = $factory->createElement([
'type' => 'text',
'name' => 'text_name',
'label' => 'Text',
]);
$buttonElement = $factory->createElement([
'type' => 'button',
'name' => 'button_name',
'label' => 'Button',
]);
// Form Helper
$formHelper = new Helper\Form();
$formTextHelper = new Helper\FormText();
$formLabelHelper = new Helper\FormLabel();
$formButtonHelper = new Helper\FormButton();
// render Form
echo $formHelper->openTag($form);
echo $formLabelHelper($textElement, 'Name');
echo $formTextHelper($textElement);
echo $formButtonHelper($buttonElement, 'click');
echo $formHelper->closeTag();