Download the PHP package gkcaptcha/gkcaptcha-laravel without Composer

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

gkcaptcha-laravel

Laravel integration package for gkCAPTCHA. Provides a service provider, middleware, validation rule, Blade directive, and Facade for CAPTCHA protection with a single line of configuration.

Requirements

Installation

The package auto-discovers via Laravel's package auto-discovery. No manual registration required.

Configuration

Publish the config file:

Add to .env:

Environment Variables

Variable Default Description
GKCAPTCHA_SECRET_KEY (required) Server-side secret key for token verification
GKCAPTCHA_SITE_KEY (required) Public site key for the widget
GKCAPTCHA_API_URL https://gkcaptcha.gatekeeper.sa gkCAPTCHA API base URL
GKCAPTCHA_TIMEOUT 5.0 Request timeout in seconds
GKCAPTCHA_FAIL_CLOSED false Block requests on network error (fail-closed)
GKCAPTCHA_WIDGET_URL https://gkcaptcha.gatekeeper.sa/widget/gk-captcha.js Widget script URL

Blade Directive

Add the CAPTCHA widget to any Blade template:

If GKCAPTCHA_SITE_KEY is set in .env, you can omit the argument:

The directive outputs:

Middleware

Route Group (recommended)

Protect a group of routes by adding VerifyCaptcha to a route group:

Global Kernel Registration (Laravel 10)

In app/Http/Kernel.php:

Then use the alias:

Token Sources

The middleware reads the CAPTCHA token from (in priority order):

  1. captchaToken body field (form POST or JSON body)
  2. X-Captcha-Token request header (AJAX / API)

Middleware Responses

Condition HTTP Status Body
No token present 403 {"success": false, "error": "CAPTCHA token required"}
Token invalid 403 {"success": false, "error": "CAPTCHA verification failed"}
Network error (fail-open) passes through Warning logged, request continues
Token valid passes through Normal route response

Validation Rule

Use the gkcaptcha rule in form request classes or inline validators:

Or with the Rule object directly:

Facade

For inline verification anywhere in your application:

Fail-Open Behavior

By default (GKCAPTCHA_FAIL_CLOSED=false), network errors when reaching the gkCAPTCHA API allow the request to proceed. A warning is logged:

This prevents gkCAPTCHA API availability from causing downtime on your application.

Set GKCAPTCHA_FAIL_CLOSED=true to block requests when the API is unreachable. This is appropriate for high-security environments where it is better to reject users than to risk allowing bots through.

Testing

The package includes PHPUnit-compatible tests using Orchestra Testbench.

With dependencies installed:

For environments without Composer (CI, Docker images without Testbench), a standalone runner is included:

License

MIT


All versions of gkcaptcha-laravel with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
gkcaptcha/gkcaptcha-php Version ^0.1
illuminate/support Version ^10.0|^11.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 gkcaptcha/gkcaptcha-laravel contains the following files

Loading the files please wait ...