PHPackages                             matt/sycaptcha - 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. [Security](/categories/security)
4. /
5. matt/sycaptcha

ActiveSymfony-bundle[Security](/categories/security)

matt/sycaptcha
==============

Bundle for form protection using captcha, includes reCaptcha and hCaptcha

v1.0.0(4y ago)110MITPHPPHP &gt;=7.1

Since Oct 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hesmatt/sycaptcha-bundle)[ Packagist](https://packagist.org/packages/matt/sycaptcha)[ RSS](/packages/matt-sycaptcha/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

SyCaptchaBundle
===============

[](#sycaptchabundle)

SyCaptchaBundle is a form protection bundle made for **Symfony**, including a set of CAPTCHA challenges that should stop any malicious requests from submitting your forms.

Supported CAPTCHAs
------------------

[](#supported-captchas)

There are **three** types of supported CAPTCHAs as of now

1. **reCaptcha V2** - By Google
2. **reCaptcha V3** - By Google
3. **hCaptcha** - By Intuition Machines

Invisible reCaptcha V2 **isn't** supported, due to the fact that it's 'lower' end version of reCaptcha V3

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

[](#installation)

With [composer](https://getcomposer.org/) require

`composer require matt/sycaptcha`

Configuration without symfony/flex
----------------------------------

[](#configuration-without-symfonyflex)

You can configure all the needed files manually when not having an option to install/upgrade to [symfony/flex](https://github.com/symfony/flex)

### 1. Register the bundle

[](#1-register-the-bundle)

Register bundle into `config/bundles.php` **Symfony 4/5**

```
return [
    Matt\SyCaptchaBundle\SyCaptchaBundle::class => ['all' => true],
];

```

Register bundle into `app/AppKernel.php` **Symfony 3 and below**

```
public function registerBundles()
{
    return [
        new Matt\SyCaptchaBundle\SyCaptchaBundle(),
    ];
}

```

### 2. Add configuration files

[](#2-add-configuration-files)

`config/packages/sy_captcha.yaml (or app/config/config.yml if using Symfony 3 or below)`

```
sy_captcha:
  recaptcha_v2:
    site_key: 'site_key'
    secret_key: 'secret_key'

```

Usage
-----

[](#usage)

Let's finally get to the part about how you can integrate those CAPTCHAS into your forms.

### 1. Create form and add the CAPTCHA protection

[](#1-create-form-and-add-the-captcha-protection)

You can add all three CAPTCHAS into the form at the same time (yes, it's overkill), however, they all need to be configured properly

```
