ZF2Kickbox is a module that provides Zend Framework 2 validator for email verification using http://kickbox.io
- Add
"byonchev/zf2-kickbox": "dev-master"
to yourcomposer.json
and runphp composer.phar update
- Add
ZF2Kickbox
to yourapplication.config.php
:
<?php
return [
'modules' => [
...
'ZF2Kickbox'
]
...
];
First, you will need to get an API key from https://kickbox.io/app/api/settings after creating an account (if you don't have one already)
- Programmatic way
<?php
use Zend\Form\Form;
use Zend\Form\Element;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use ZF2Kickbox\Validator\Kickbox;
class RegistrationForm extends Form
{
public function __construct($name = null, $options = [])
{
parent::__construct($name, $options);
$this->add(new Element('email'));
$inputFilter = new InputFilter();
$input = new Input('email');
$kickboxValidator = new Kickbox(['apiKey' => 'xxxxxxxxxxxxxxxxx']);
$input->getValidatorChain()->attach($kickboxValidator);
$inputFilter->add($input);
$this->setInputFilter($inputFilter);
}
}