Download the PHP package zhylon/captcha-php without Composer
On this page you can find all versions of the php package zhylon/captcha-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zhylon/captcha-php
More information about zhylon/captcha-php
Files in zhylon/captcha-php
Package captcha-php
Short Description PHP client for server-side verification of Zhylon Captcha tokens.
License MIT
Homepage https://github.com/Zhylon/zhylon-captcha-php
Informations about the package captcha-php
captcha-php
PHP client for server-side verification of Zhylon Captcha tokens.
Installation
Usage
CaptchaClient
| Parameter | Type | Default | Description |
|---|---|---|---|
secretKey |
string |
— | Your Zhylon Captcha secret key |
verifyUrl |
string |
https://captcha.zhylon.net/captcha/siteverify |
Verification endpoint |
timeout |
int |
5 |
Request timeout in seconds |
CaptchaResult
| Property | Type | Description |
|---|---|---|
success |
bool |
Whether verification succeeded |
reason |
?string |
invalid_token, config_error, or network_error on failure |
message |
?string |
Human-readable explanation |
Use $result->isTechnicalFailure() to distinguish infrastructure problems (config_error, network_error) from a genuinely invalid token.
Self-hosted challenge/verify proxy
If your widget's JS talks to your own domain instead of captcha.zhylon.net directly, use CaptchaProxy to forward the captcha/challenge and captcha/verify calls to the real Zhylon Captcha host. It reuses the host already configured on your CaptchaClient, so no extra configuration is needed, and it never lets an upstream failure (e.g. a misconfigured endpoint) turn into an uncaught exception — you always get back a status code and a JSON body to relay as-is.
Note: CaptchaProxy::verify() forwards the proof-of-work captcha/verify call (used to obtain a verification_token). It is unrelated to CaptchaClient::verify(), which is the server-side siteverify check performed with your secret key.
CaptchaProxy
| Parameter | Type | Default | Description |
|---|---|---|---|
baseUrl |
string |
https://captcha.zhylon.net |
Host the challenge/verify calls are forwarded to |
timeout |
int |
5 |
Request timeout in seconds |
Use CaptchaProxy::forClient($client) to derive baseUrl automatically from an existing CaptchaClient's verifyUrl.
On an upstream failure (unreachable host, non-2xx response, or invalid JSON), challenge()/verify() return a CaptchaProxyResponse with status = 502 and a body of ['error' => '...'] instead of throwing.
Testing
License
The MIT License (MIT). See LICENSE for more information.
All versions of captcha-php with dependencies
ext-curl Version *
ext-json Version *