byonchev / zf2-kickbox
Zend Framework 2 Module that provides email validation via http://kickbox.io
dev-master
2016-06-08 09:02 UTC
Requires
- php: >=5.3.3
- kickbox/kickbox: ~2.0.0
Requires (Dev)
This package is not auto-updated.
Last update: 2025-03-29 21:46:10 UTC
README
ZF2Kickbox is a module that provides Zend Framework 2 validator for email verification using http://kickbox.io
Installation
- Add
"byonchev/zf2-kickbox": "dev-master"
to yourcomposer.json
and runphp composer.phar update
- Add
ZF2Kickbox
to yourapplication.config.php
:
<?php return [ 'modules' => [ ... 'ZF2Kickbox' ] ... ];
Usage
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); } }