Download the PHP package excelwebzone/recaptcha-bundle without Composer

On this page you can find all versions of the php package excelwebzone/recaptcha-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package recaptcha-bundle

EWZRecaptchaBundle

Actions Status

This bundle provides easy reCAPTCHA form field for Symfony.

Installation

Step 1: Use composer and enable Bundle

To install EWZRecaptchaBundle with Composer just type in your terminal:

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:

Step2: Configure the bundle's

NOTE: The configuration options differ between Version 2 and Version 3 of the reCAPTCHA system. Some of the previous options have no effect on Version 3.

Add the following to your config file:

NOTE: If you're using symfony 4, the config will be in config/packages/ewz_recaptcha.yaml. The local dev enviroment has its own config in config/packages/dev/ewz_recaptcha.yaml.

Main configuration for both v2 and v3

The version setting determines which configuration options are available. Set the version corresponding to your Google reCAPTCHA settings (valid values: 2 or 3):

You can easily disable reCAPTCHA (for example in a local or test environment):

Enter the public and private keys here:

www.google.com is blocked in Mainland China, you can override the default server like this (See https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally for further information):

You can add HTTP Proxy configuration:

v2 only Configuration

Sets the default locale:

NOTE: This Bundle lets the client browser choose the secure https or unsecure http API.

If you want to use the language default for the reCAPTCHA the same as the request locale you must activate the resolver (deactivated by default):

You can load the reCAPTCHA using Ajax:

In case you have turned off the domain name checking on reCAPTCHA's end, you'll need to check the origin of the response by enabling the verify_host option:

NOTE: If you're using symfony 5 and want to configure the bundle with PHP files instead of YAML, the configuration is like this:

v3 only Configuration

For the v3 reCAPTCHA an information badge is shown. If you inform your users about using the reCAPTCHA on another way, you can hide it with the following option (see https://developers.google.com/recaptcha/docs/faq#hiding-badge for further information):

To modify the default threshold score of 0.5 set this option (see https://developers.google.com/recaptcha/docs/v3#interpreting_the_score for further information):

Congratulations! You're ready!

Basic Usage

NOTE: The basic usage differs between Version 2 and Version 3 of the reCAPTCHA system.

v2 Usage

When creating a new form class add the following line to create the field:

Note that in Symfony versions lower than 2.8 refers to form types by name instead of class name, use:

You can pass extra options to reCAPTCHA with the "attr > options" option:

Support Google's Invisible is super easy:

Note: If you use the pre-defined callback, you would need to add recaptcha-form class to your <form> tag.

If you need to configure the language of the captcha depending on your site language (multisite languages) you can pass the language with the "language" option:

To validate the field use:

Another method would consist to pass the validation constraints as an options of your FormType. This way, your data class contains only meaningful properties. If we take the example from above, the buildForm method would look like this. Please note that if you set then the annotation will not work. You have to also set :

The form template resource is now auto registered via an extension of the container. However, you can always implement your own custom form widget.

PHP:

Twig:

If you are not using a form, you can still implement the reCAPTCHA field using JavaScript:

PHP:

Twig:

Customization

If you want to use a custom theme, put your chunk of code before setting the theme:

v3 Usage

When creating a new form class add the following line to create the field:

You can pass the action to reCAPTCHA with the "action_name" option (see https://developers.google.com/recaptcha/docs/v3#actions for further information)::

To validate the field use:

Another method would consist to pass the validation constraints as an options of your FormType. This way, your data class contains only meaningful properties. If we take the example from above, the buildForm method would look like this. You have to also set :

Advanced Usage

It is possible to register reCAPTCHA form services. To accomplish this, enter the service definition as follows (in this example we did it in PHP):

Now the services are now accessible with . They can be registered to your form type class:

The form type class itself uses the injected service this way:


All versions of recaptcha-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
google/recaptcha Version ^1.1
symfony/form Version ^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0
symfony/framework-bundle Version ^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0
symfony/security-bundle Version ^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0
symfony/validator Version ^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0
symfony/yaml Version ^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0
twig/twig Version ^1.40 || ^2.9 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package excelwebzone/recaptcha-bundle contains the following files

Loading the files please wait ....