notafacil/zf3-coinhive-captcha
Composer 安装命令:
composer require notafacil/zf3-coinhive-captcha
包简介
CoinHive Captcha module for Zend Framework 2 & 3 (ZF2 / ZF3)
关键字:
README 文档
README
Simple way to use the coinhive.com captcha
Installation
with composer
Just add the following line to your requirements:
composer require notafacil/zf3-coinhive-captcha
and run
php composer.phar update
Since there are problems with the SSL-Cert if you use Adapter\Socket, please install php-curl!
Then activate the module in your application.config.php :
```php
return array(
'modules' => array(
// ...
'CoinHiveCaptcha',
),
// ...
);
```
Get your private-key
To use this service, you have to register at CoinHive using your CoinHive Account.
Usage
with Zend\From
Just add the following lines to your form creation:
$element = new \Zend\Captcha\Captcha('coinhive-captcha-token');
$element->setCaptcha(new CoinHiveCaptcha\CoinHiveCaptcha(array('secret_key' => 'YOUR_SECRET', 'public_key' => 'YOUR_PUBLIC_KEY', 'hashes' => 512)));
$form->add($element);
Remember to add this element to your validationChain as well.
It acts the same way as any other built-in captcha solution.
with ServiceManager
If you like to implement the view on your own, just use the Service\CoinHiveCaptchaService. It handles the whole communication between your code and the CoinHive API.
$recaptcha = $serviceLocator->get('CoinHiveCaptcha\Service\CoinHiveCaptchaService');
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-05