Download the PHP package gkcaptcha/gkcaptcha-php without Composer

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

gkcaptcha-php

PHP SDK for gkCAPTCHA token verification.

Zero Composer runtime dependencies — only php >=8.1 required.


Quick Start


Installation


HTTP Transport

No Guzzle, no PSR-18, no additional Composer packages required.


Constructor Parameters

Parameter Type Default Description
secretKey string '' Your Gatekeeper secret key. Env: GKCAPTCHA_SECRET_KEY
siteKey string '' Your Gatekeeper site key. Env: GKCAPTCHA_SITE_KEY
apiUrl string https://gkcaptcha.gatekeeper.sa Override API base URL. Env: GKCAPTCHA_API_URL
timeout float 5.0 HTTP request timeout in seconds.
maxRetries int 1 Number of retries on network error.
retryDelay float 1.0 Delay between retries in seconds.
failClosed bool false See Fail-Open / Fail-Closed below.

All string parameters can be omitted and resolved from environment variables.


Fail-Open / Fail-Closed

Default: Fail-Open

If the Gatekeeper API is unreachable (network error, timeout) after all retries, the client returns a successful response with failOpen=true — the request passes through.

This is the industry-standard default (used by reCAPTCHA and hCaptcha). It protects legitimate users during API outages.

Fail-Closed Mode

To block requests on network failure, set failClosed: true:


verifyToken()

Parameter Description
token The token from the captcha-verified CustomEvent.
clientIP Optional client IP for binding verification.
userAgent Optional User-Agent for binding verification.

VerifyTokenResponse Properties

Property Type Description
success bool true if verification passed.
score float Risk score 0.0 (human) – 1.0 (bot).
timestamp int Unix timestamp when the token was issued.
error ?string Human-readable error message on failure.
reasonCode ?string Machine-readable reason code on failure.
failOpen bool true when success was returned due to fail-open policy.

Error Codes

Code When thrown
INVALID_CONFIG secretKey or siteKey empty after env var resolution.
NETWORK_ERROR HTTP transport failure (curl error, timeout).

Only thrown as GkCaptchaException with failClosed=true for NETWORK_ERROR. INVALID_CONFIG always throws regardless of failClosed.


ReasonCode Enum Values

VerifyTokenResponse::$reasonCode contains one of these strings on failure:

Value Meaning
missing_token Token field was empty in the request.
invalid_site_key Site key not found.
invalid_secret Secret key does not match.
site_disabled Site has been disabled.
invalid_signature Token signature verification failed.
token_expired Token has exceeded its TTL.
site_key_mismatch Token was issued for a different site key.
token_already_used Token has already been consumed.
binding_mismatch IP or User-Agent does not match the token.
internal_error Unexpected server-side error.

Use the ReasonCode enum for type-safe comparisons:


Laravel Quick Start


Testing


License

MIT — see LICENSE.


All versions of gkcaptcha-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 gkcaptcha/gkcaptcha-php contains the following files

Loading the files please wait ...