Zendframework 3 – Create a simple form

In this tutorial, we will see how to create a simple form using Zend framework 3. To create a form in zendframework you have to install Zend-form component. You can install it using following composer command in your terminal. So you go the root of your project and run the command

You need zend-i18n to render the form in your view

You can create the following for at module\Application\src\Form\ProductForm.php

I have created two Text fields and Submit button in this code

Now you can create the ProductForm object and pass it into the ViewModel as an argument. So you can place the following code in your controller

Now you have the ProductForm object inside your ViewModel and you can add following code to view file at

Now you can see this kind of simple form