Download the PHP package germania-kg/googlerecaptcha without Composer

On this page you can find all versions of the php package germania-kg/googlerecaptcha. 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 googlerecaptcha

Germania KG · GoogleRecaptcha

Callable wrapper, Slim3 Middleware and Pimple-style Service Provider for Google's ReCaptcha.

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status

Installation with Composer

Alternatively, add this package directly to your composer.json:

Usage

The following examples assume you're working with Pimple or Slim Framework and have your DI container at hand:


ServiceProvider

See chapter reCAPTCHA v2 FAQ.


Slim3-style Middleware

Before the route controller is executed, this middleware checks

  1. whether there is a recaptcha user input in $_POST['g-recaptcha-response']
  2. whether the validation with Google's ReCaptcha client succeeds.

Dependent on the results, this middleware does

The string identifiers used here can be modified in the Google.Recaptcha.Config service, see below.

IMPORTANT NOTICE: The middleware will call the $next middleware, regardless of the validation status. Any route controller should check for the HTTP status itself and react accordingly. The GoogleRecaptcha Request attribute array will help – just ask for failed or success or status elements.


Callable validation wrapper

The ReCaptcha validation client is instantiated automatically. The callable wrapper uses the same logger instance than the Google.Recaptcha.Validator on how to setup your own validator instance.


The services in detail

Google.Recaptcha.PublicKey

This is the service you surely will need most often.

Google.Recaptcha.Logger

The default logger has been passed on instantiation. Override or customize like this:

Google.Recaptcha.ClientIP

The client API is used to ask Googles web API; its default is $_SERVER['REMOTE_ADDR']. You normally will not need to override this:

Google.Recaptcha.Validator

This creates Google's server-side validation client which comes with the official ReCaptcha\ReCaptcha library. It will be automatically installed with this GoogleRecaptcha package and automatically instantiated. If you wish to create your own, do something like:

Google.Recaptcha.Validator.Callable

is a callable wrapper, i.e. an invokable class, around the Google.Recaptcha.Logger instance from above, logging an info on success and a notice on failure.

When instantiated manually, it accepts an optional logger.

Google.Recaptcha.Config

This configuration array is used by the GoogleRecaptchaMiddleware and provides these values:

field value description
input_field g-recaptcha-response The form field name
status_code  400 The Response status when validation fails
request_attribute GoogleRecaptcha The Request attribute name for validation information

Development

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:


All versions of googlerecaptcha with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6|^7.0
pimple/pimple Version ^3.0
google/recaptcha Version ^1.1
psr/log Version ^1.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 germania-kg/googlerecaptcha contains the following files

Loading the files please wait ....