Download the PHP package shevabam/simple-hcaptcha without Composer
On this page you can find all versions of the php package shevabam/simple-hcaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shevabam/simple-hcaptcha
More information about shevabam/simple-hcaptcha
Files in shevabam/simple-hcaptcha
Package simple-hcaptcha
Short Description A simple PHP library to integrate hCaptcha in your PHP applications
License MIT
Homepage https://github.com/shevabam/simple-hcaptcha
Informations about the package simple-hcaptcha
Simple hCaptcha
A simple PHP library to integrate hCaptcha in your PHP applications.
Requirements
- PHP 7.4 or higher
- cURL extension
- JSON extension
Installation
Install via Composer:
Usage
Basic Usage
Available Methods
getScript(): string
Generate the HTML code to include the hCaptcha script.
display(): string
Generate the HTML code to display the hCaptcha widget.
isValid(string $response, ?string $remoteIp = null): bool
Verify if the CAPTCHA response is valid.
getError(): string
Get the error message of the last operation.
getErrorCode(): ?string
Get the error code of the last operation.
setTheme(string $theme): self
Set the theme of the hCaptcha widget ('light' or 'dark').
setSize(string $size): self
Set the size of the hCaptcha widget ('normal' or 'compact').
setLanguage(string $language): self
Set the language of the hCaptcha widget.
setOption(string $key, $value): self
Set a custom option.
Configuration
You can configure the hCaptcha widget by passing an array of options to the constructor or using the setter methods:
Usage
To generate the script tag, use :
To display the widget in your form, use :
To verify the CAPTCHA response, use :
Error Handling
When isValid() returns false, you can get the error message using getError():
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
Created by @shevabam
All versions of simple-hcaptcha with dependencies
ext-curl Version *
ext-json Version *