# Using laminas form in standalone project

**URL:** <https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972>\
**Category:** Components & MVC\
**Tags:** laminas-form\
**Created:** [November 28, 2020, 4:12pm UTC](https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972 "2020-11-28T16:12:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![at92](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/at92/32/840_2.png) [@at92](https://discourse.laminas.dev/u/at92)\
**Post date:** [November 28, 2020, 4:12pm UTC](https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972/1 "2020-11-28T16:12:05Z")

</div>

Hi there,

I’m trying to use the laminas form component in a custom project but I’m having a few issues and I’m not sure if the component can be used in standalone projects.

Following the documentation, I created a sample form

```
class ContactForm extends Form
{
    public function __construct()
    {
        parent::__construct();
        $this->add([
            'name' => 'name',
            'options' => [
                'label' => 'Your name',
            ],
            'type' => 'Text',
        ]);
        $this->add([
            'type' => Element\Email::class,
            'name' => 'email',
            'options' => [
                'label' => 'Your email address',
            ],
        ]);
        $this->add([
            'name' => 'send',
            'type' => 'Submit',
            'attributes' => [
                'value' => 'Submit',
            ],
        ]);
    }
}

```

Which I then render like this:

```
use Laminas\Form\View\Helper\Form as HelperForm;

$form = new ContactForm();

$form->prepare();

$form->setAttribute('action', '#');

$form->setAttribute('method', 'post');

$fHelper = new HelperForm( $form );
$fHelper->render( $form );

```

This is the first error I get

```auto
Class 'Laminas\I18n\View\Helper\AbstractTranslatorHelper' not found

```

So I’ve gone ahead and ran

```auto
composer require laminas/laminas-i18n

```

Is it possible to avoid using the i18n library if I don’t need it?

After loading the i18n library, the form gives me this error

```auto
Class 'Laminas\View\Helper\AbstractHelper' not found

```

So I’ve done

```auto
composer require laminas/laminas-view

```

Ultimately the forms gives me this error:

```auto
Call to a member function formRow() on null in laminas/laminas-form/src/View/Helper/Form.php on line *74*

```

And now I’m stuck, any ideas how to solve this?

---

<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:** [November 30, 2020, 12:43pm UTC](https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972/2 "2020-11-30T12:43:55Z")

</div>

Short example:

```php
// Init form
$form = new ContactForm();
$form->setAttribute('action', '…');

// Render form
/** @var Laminas\View\Renderer\PhpRenderer|Laminas\Form\View\HelperTrait $renderer */
$renderer = new Laminas\View\Renderer\PhpRenderer();
$renderer->getHelperPluginManager()->configure(
    (new Laminas\Form\ConfigProvider())->getViewHelperConfig()
);
echo $renderer->form($form);

```

(The `Form` helper calls the `prepare` method and `post` is default request method.)

---

<div class="post-metadata">

**Author:** ![at92](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/at92/32/840_2.png) [@at92](https://discourse.laminas.dev/u/at92)\
**Post date:** [November 30, 2020, 2:01pm UTC](https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972/3 "2020-11-30T14:01:43Z")

</div>

Thanks a lot, it’s working 🙂

---

<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:** [December 1, 2020, 7:05am UTC](https://discourse.laminas.dev/t/using-laminas-form-in-standalone-project/1972/4 "2020-12-01T07:05:12Z")

</div>

I will add this to the documentation, as we have for other components:

> **[Stand-Alone - laminas-i18n - Laminas Docs](https://docs.laminas.dev/laminas-i18n/application-integration/stand-alone/)**

  

> **[Stand-Alone - laminas-paginator - Laminas Docs](https://docs.laminas.dev/laminas-paginator/application-integration/stand-alone/)**

  

> **[Stand-Alone - laminas-view - Laminas Docs](https://docs.laminas.dev/laminas-view/application-integration/stand-alone/)**
