PHP code example of anlutro / form

1. Go to this page and download the library: Download anlutro/form library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anlutro / form example snippets


use anlutro\Form\DefaultForm;
public function __construct(DefaultForm $form)
{
	$this->form = $form;
}

$this->form = new DefaultForm($formBuilder);

// The model is where the form gets its data. It can be an existing active-
// record model, entity or an array of dummy data.
$this->form->setModel($myModel);
$this->form->setAction('http://mysite.com/my-route');
$this->form->setMethod('PUT');

<?= $form->open(['class' => 'form-horizontal']) 

$input = $this->form->getInput();
$this->service->doStuff($input);

use anlutro\Form\AbstractForm;
class MyForm extends AbstractForm {}