PHPackages                             xorock/zend-service-recaptcha-v2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. xorock/zend-service-recaptcha-v2

ActiveLibrary[HTTP &amp; Networking](/categories/http)

xorock/zend-service-recaptcha-v2
================================

Zend Framework 3 service for Google ReCaptcha v2

0.1.0(9y ago)13.4k2[1 PRs](https://github.com/xorock/zend-service-recaptcha-v2/pulls)BSD-3-ClausePHPPHP ^5.5 || ^7.0

Since Nov 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/xorock/zend-service-recaptcha-v2)[ Packagist](https://packagist.org/packages/xorock/zend-service-recaptcha-v2)[ RSS](/packages/xorock-zend-service-recaptcha-v2/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

\#Zend Framework 3 integration with Google ReCaptcha v2

Provides [Google ReCaptcha v2](https://www.google.com/recaptcha/intro/index.html) integration for [Zend Framework 3](https://github.com/zendframework/zendframework).

Installation
------------

[](#installation)

Install this library using composer:

```
$ composer require xorock/zend-service-recaptcha-v2
```

Then add `ZfServiceReCaptcha2` to Your module config under the `modules` key.

Using Zend Framework Captcha element
------------------------------------

[](#using-zend-framework-captcha-element)

```
use Zend\Form\Element\Captcha;
use ZfServiceReCaptcha2\Captcha\ReCaptcha2;

$this->add([
    'type'       => Captcha::class,
    'name'       => 'g-recaptcha-response', // name is required for element to be validated
    'options'    => [
        'label' => 'Please answer question',
        'captcha' => [
            'class' => ReCaptcha2::class,
            'options' => [
                'hl' => 'en', // english is set by deafult, this line is not required
                'theme' => 'light', // see options below
                'callback' => '', // callback function, etc.
                'public_key'  => 'Generated public key',
                'private_key' => 'Generated private key'
            ],
        ],
    ],
]);
```

Options
-------

[](#options)

Form element allows two different type of options: params and attributes. Both refer to  configuration options. Parameters are published inside 'script' tag, while the attributes referes to 'div.g-recaptcha element'. By default they are defined as:

```
/**
 * Parameters for the script object
 *
 * @var array
 */
protected $params = array(
    'onload' => null,
    'render' => 'onload',
    'hl'     => 'en'
);

/**
 * Attributes for div element
 *
 * @var array
 */
protected $attributes = array(
    'class'            => 'g-recaptcha',
    'theme'            => 'light',
    'type'             => 'image',
    'tabindex'         => 0,
    'callback'         => null,
    'expired-callback' => null
);
```

ReCaptcha2 form element
-----------------------

[](#recaptcha2-form-element)

ZfServiceReCaptcha2 component also comes with a predefined element `ReCaptcha2`, which extends built-in `\Zend\Form\Element\Captcha`. By default, it consumes following config:

```
return [
    'zfservicerecaptcha2' => [
        'recaptcha' => [
            'options' => [
                // Captcha options
                'hl' => 'en',
                'public_key'  => 'Generated public key',
                'private_key' => 'Generated private key'
            ],
        ]
    ]
];
```

It is convenient to set Your ReCaptcha keys and other options in general application configuration. You can use this element by simply defining

```
use ZfServiceReCaptcha2\Form\Element\ReCaptcha2;

$this->add([
    'type'       => ReCaptcha2::class,
    // Field name is defined by factory
    // 'name'       => 'g-recaptcha-response',
    'options'    => [
        'label' => 'Please answer question',
    ],
]);
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3525d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111481?v=4)[xorock](/maintainers/xorock)[@xorock](https://github.com/xorock)

---

Top Contributors

[![xorock](https://avatars.githubusercontent.com/u/111481?v=4)](https://github.com/xorock "xorock (8 commits)")

---

Tags

httpzendrecaptchacaptchaformzf3

### Embed Badge

![Health badge](/badges/xorock-zend-service-recaptcha-v2/health.svg)

```
[![Health](https://phpackages.com/badges/xorock-zend-service-recaptcha-v2/health.svg)](https://phpackages.com/packages/xorock-zend-service-recaptcha-v2)
```

###  Alternatives

[crowdsec/bouncer

The official PHP bouncer library for the CrowdSec Local API

199.1k2](/packages/crowdsec-bouncer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
