1. Go to this page and download the library: Download saeven/zf2-purifier 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/ */
saeven / zf2-purifier example snippets
namespace Application\Form;
use Zend\InputFilter;
use Zend\Form\Form;
class Foo extends Form implements
InputFilter\InputFilterProviderInterface
{
public function __construct($name = null)
{
parent::__construct($name);
$this->add(array(
'name' => 'title',
'options' => array(
'label' => 'Title'
),
));
$this->add(array(
'name' => 'text',
'options' => array(
'label' => 'Text'
),
'attributes' => array(
'type' => 'textarea',
),
));
}
public function getInputFilterSpecification()
{
return array(
'title' => array(
'
use Zend\Filter\FilterChain;
$form = new MyForm;
// $sl is the service locator
$plugins = $sl->get('FilterManager');
$chain = new FilterChain;
$chain->setPluginManager($plugins);
$form->getFormFactory()->getInputFilterFactory()->setDefaultFilterChain($chain);
use Soflomo\Common\Form\FormUtils;
$form = new MyForm;
// $sl is the service locator
FormUtils::injectFilterPluginManager($form, $sl);