use Zend\Form\Form; $form = new Form(); $form->add([ 'name' => 'input-field', 'type' => 'text', 'options' => [ 'label' => 'Input Field:', ], ]);
use Zend\Form\Form; use Zend\Form\Element; $form = new Form(); $form->add([ 'name' => 'first-name', 'type' => Element\Text::class, 'options' => [ 'label' => 'First Name:', ], ]); $form->add([ 'name' => 'last-name', 'type' => Element\Text::class, 'options' => [ 'label' => 'Last Name:', ], ]); $form->add([ 'name' => 'submit', 'type' => Element\Submit::class, 'attributes' => [ 'value' => 'Submit', ], ]);
use Zend\Form\Form; use Zend\Form\Element; use Zend\InputFilter\InputFilter; use Zend\Validator\StringLength; $form = new Form(); $form->add([ 'name' => 'password', 'type' => Element\Password::class, 'options' => [ 'label' => 'Password:', ], ]); $form->setInputFilter(new InputFilter()); $form->getInputFilter()->add([ 'name' => 'password', 'required' => true, 'validators' => [ [ 'name' => StringLength::class, 'options' => [ 'min' => 8, 'max' => 20, ], ], ], ]);In conclusion, the "zend-form" package is a part of the "zendframework/zend-form" library. It provides a wide range of options to create and manage HTML forms with ease.