PHP code example of stroker / form

1. Go to this page and download the library: Download stroker/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/ */

    

stroker / form example snippets


     'StrokerForm',
     


namespace MyProject\Service;

use Zend\ServiceManager\ServiceLocatorInterface;

class MyFormFactory implements \Zend\ServiceManager\FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $form = new MyForm();
        $model = new MyModel();
        $form->setInputFilter($model->getInputFilter());
        return $form;
    }
}


return array(
    'stroker_form' => array(
        'forms' => array(
            'factories' => array(
                'my_form_alias' => 'MyProject\Service\MyFormFactory'
            )
        )
    )
);


$this->strokerFormPrepare('my_form_alias');

// Do your normal form rendering here

$name = new Element('name');
$name->setLabel('Your name');
$name->setOption('strokerform-exclude', true);
html
<head>
   echo $this->headLink()