# Documentation about form component rendering with laminas-mvc

**URL:** <https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027>\
**Category:** Components & MVC\
**Tags:** laminas-form, laminas-mvc\
**Created:** [August 27, 2022, 10:15pm UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027 "2022-08-27T22:15:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fgsl](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/fgsl/32/923_2.png) [@fgsl](https://discourse.laminas.dev/u/fgsl)\
**Post date:** [August 27, 2022, 10:15pm UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027/1 "2022-08-27T22:15:31Z")

</div>

I faced a problem with laminas-form rendering in an application using laminas-mvc. The form components were not rendered without explicit configuration in module.config.php. The view helper throwed an exception if the configuration was absent. No finding something about it in documentation, I followed to writing the configuration for each form component. For being more clear, I needed to have this in my module.config.php:

```auto

'view_helpers' => [
        'aliases' => [
            'form' => Form::class,
            'formText' => FormText::class,
            'formSelect' => FormSelect::class,
            'formNumber' => FormNumber::class,
            'formHidden' => FormHidden::class,
            'formLabel' => FormLabel::class,
            'formPassword' => FormPassword::class
        ],
        'factories' => [
            Form::class => InvokableFactory::class,
            FormText::class => InvokableFactory::class,
            FormSelect::class => InvokableFactory::class,
            FormNumber::class => InvokableFactory::class,
            FormHidden::class => InvokableFactory::class,
            FormLabel::class => InvokableFactory::class,
            FormPassword::class => InvokableFactory::class
        ]
    ]

```

Another developer said me that it is not necessary. The problem was the absence of laminas-mvc-form in composer.json. Well, I removed this part and added laminas-mvc-form with a composer require laminas/laminas-mvc-form. The result is that Laminas/Form is not found.

I would like a clarification. What is the right procedure for enabling the form rendering? The concise documentation of laminas-mvc-form does not seem to tell me that it is a coupling component, which is necessary to enable form rendering when laminas-form is used in combination with laminas-mvc. In fact, we didn’t find references about laminas-mvc-form as an required component to use forms in laminas-mvc based applications.

If there is a documentation about it, please let me know the address. Thank you very much!

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 31, 2022, 9:17am UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027/2 "2022-08-31T09:17:14Z")

</div>

> [@fgsl](#):
>
> I would like a clarification. What is the right procedure for enabling the form rendering?

Adding laminas-form as module to your application configuration. If you use the [skeleton application of laminas-mvc](https://docs.laminas.dev/laminas-mvc/quick-start/#install-the-laminas-mvc-skeleton-application) then [this step is automated](https://docs.laminas.dev/laminas-form/v3/installation/#installation-for-mezzio-and-laminas-mvc-application).

* * *

laminas-mvc-form is only a [meta package](https://getcomposer.org/doc/04-schema.md#type) which will install laminas-form, laminas-i18n and [doctrine/annotations](https://www.doctrine-project.org/projects/annotations.html):

> <https://github.com/laminas/laminas-mvc-form/blob/6f46662c4c279e1b78e997d5f040c74121155ade/composer.json#L27-L31>

---

<div class="post-metadata">

**Author:** ![fgsl](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/fgsl/32/923_2.png) [@fgsl](https://discourse.laminas.dev/u/fgsl)\
**Post date:** [August 31, 2022, 10:44am UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027/3 "2022-08-31T10:44:03Z")

</div>

Thank you very much. It is clear now.

For enabling the rendering, laminas-form must be added as a module.

There is no need to install laminas-mvc-form.

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 31, 2022, 12:01pm UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027/4 "2022-08-31T12:01:01Z")

</div>

With the registration of the module in your application the following services are registered:

> <https://github.com/laminas/laminas-form/blob/d9b0ad888f58ecc7ccd01131c8be0d4d8b1093d3/src/ConfigProvider.php#L32-L46>

And the following view helpers are registered for laminas-view:

> <https://github.com/laminas/laminas-form/blob/d9b0ad888f58ecc7ccd01131c8be0d4d8b1093d3/src/ConfigProvider.php#L58-L306>

So no magic! 😃

---

<div class="post-metadata">

**Author:** ![fgsl](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/fgsl/32/923_2.png) [@fgsl](https://discourse.laminas.dev/u/fgsl)\
**Post date:** [August 31, 2022, 11:01pm UTC](https://discourse.laminas.dev/t/documentation-about-form-component-rendering-with-laminas-mvc/3027/5 "2022-08-31T23:01:49Z")

</div>

@froschdesign , you are very kind. Thank you.
