Documentation about form component rendering with laminas-mvc

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:


'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!

Adding laminas-form as module to your application configuration. If you use the skeleton application of laminas-mvc then this step is automated.


laminas-mvc-form is only a meta package which will install laminas-form, laminas-i18n and doctrine/annotations:

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.

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

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

So no magic! :smiley:

@froschdesign , you are very kind. Thank you.