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
Class 'Laminas\I18n\View\Helper\AbstractTranslatorHelper' not found
So I’ve gone ahead and ran
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
Class 'Laminas\View\Helper\AbstractHelper' not found
So I’ve done
composer require laminas/laminas-view
Ultimately the forms gives me this error:
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?