Download the PHP package meteo-concept/hcaptcha-bundle without Composer

On this page you can find all versions of the php package meteo-concept/hcaptcha-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 hcaptcha-bundle

HCaptcha bundle for Symfony 3+ Symfony

This bundle brings into your Symfony website a new Form type, namely HCaptchaType, that is used to display and validate a CAPTCHA served by https://www.hcaptcha.com.

This bundle is tested for Symfony major versions 3, 4, 5 and 6. Major version 2 works for Symfony 3 and 4, with PHP 7.2+ ; major version 3 for Symfony 5 and 6 with PHP 7.4 or 8.x ; major version 4 for Symfony 6.4 and 7 with PHP 8.2+. The test dependencies requirements can be more stringent.

Installation

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

In order to avoid making you install another HTTP client if you already have a compatible one, this bundle depends on virtual packages, namely PSR-18 psr/http-client-interface and PSR-17 psr/http-factory-interface. If you don't have any real package already installed in your application providing an implementation for these, composer will complain that the bundle is not installable. In this case, you have to provide a real implementation at the same time as the bundle.

For instance, starting from Symfony 4:

For Symfony 3:

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Install the bundle with one of the commands above. You now have to enable it and configure it without the recipe.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Configuration

This captcha is provided with a Symfony flex contrib recipe so it should come with a configuration if you have those enabled. Otherwise, you can copy the configuration from the contrib repository: https://github.com/symfony/recipes-contrib/tree/master/meteo-concept/hcaptcha-bundle.

Configure the bundle, for instance in config/packages/meteo_concept_hcaptcha.yml:

with the corresponding change in .env:

The site key and secret are the values hCaptcha gives you at https://dashboard.hcaptcha.com. The global configuration makes all captchas use the same site key by default but it's possible to change it in the definition of each form.

The values shown here are dummy values usable for integration testing (https://docs.hcaptcha.com/#integrationtest). Put the real values in .env.local (at least, the secret, the site key is public).

The validation can be set to 'strict' or 'lax'. If it's 'lax', then the CAPTCHA will be considered valid even if the hCaptcha endpoint times out or return a HTTP 500 error for instance (so as to not frustrate the users too much). If it's strict (the default), then the CAPTCHA will not be considered valid unless the endpoint returns a "success: true" answer.

Configure Twig to load the specific template for the hCaptcha widget (or provide your own).

If you use Guzzle or another HTTP library, you may also need a configuration for that bundle and its services. For instance, for Guzzle, you probably need the following in services.yaml:

Usage

Use the captcha in your forms:

By default, the HCaptchaFormType class validates the field against constraints NotBlank and IsValidCaptcha (a new constraint installed with this bundle whose validator makes the CAPTCHA check by calling the hCaptcha API). You can override this set of constraints by passing the constraints option to the form builder. Also, HCaptchaFormType fields are passed 'mapped' => false by default since it doesn't make much sense to persist CAPTCHA values.

Updates and breaking changes


All versions of hcaptcha-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/http-client Version ^1.0
psr/http-message Version ^1.0|^2.0
psr/http-client-implementation Version ^1.0
psr/http-factory-implementation Version ^1.0
symfony/config Version ~6.4|~7.0
symfony/twig-bridge Version ~6.4|~7.0
symfony/form Version ~6.4|~7.0
symfony/validator Version ~6.4|~7.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 meteo-concept/hcaptcha-bundle contains the following files

Loading the files please wait ....