PHPackages                             seanhayes-com/laravel-hcaptcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. seanhayes-com/laravel-hcaptcha

ActiveLibrary

seanhayes-com/laravel-hcaptcha
==============================

Client library for hCAPTCHA, a free service that protects websites from spam and abuse.

1.2(5y ago)014.8k↓33.3%[1 issues](https://github.com/seanhayes-com/laravel-hcaptcha/issues)BSD-3-ClausePHPPHP &gt;=5.5

Since Feb 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/seanhayes-com/laravel-hcaptcha)[ Packagist](https://packagist.org/packages/seanhayes-com/laravel-hcaptcha)[ Docs](https://github.com/seanhayes-com/laravel-hcaptcha)[ RSS](/packages/seanhayes-com-laravel-hcaptcha/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

hCAPTCHA PHP client library
===========================

[](#hcaptcha-php-client-library)

hCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse. This is a PHP library that wraps up the server-side verification step required to process responses from the hCAPTCHA service.

- hCAPTCHA:
- This repo:
- Version: 1.2.4
- License: BSD, see [LICENSE](LICENSE)

Installation
------------

[](#installation)

### Composer (recommended)

[](#composer-recommended)

Run the following command from your project directory to add the dependency:

```
composer require seanhayes-com/laravel-hcaptcha "^1.2"
```

Alternatively, add the dependency directly to your `composer.json` file:

```
"require": {
    "seanhayes-com/laravel-hcaptcha": "^1.2"
}
```

### Direct download

[](#direct-download)

Download the [ZIP file](https://github.com/seanhayes-com/laravel-hcaptcha/archive/master.zip)and extract into your project. An autoloader script is provided in `src/autoload.php` which you can require into your script. For example:

```
require_once '/path/to/hcaptcha/src/autoload.php';
$hcaptcha = new \HCaptcha\HCaptcha($secret);
```

The classes in the project are structured according to the [PSR-4](http://www.php-fig.org/psr/psr-4/) standard, so you can also use your own autoloader or require the needed files directly in your code.

Usage
-----

[](#usage)

First obtain the appropriate keys for the type of hCAPTCHA you wish to integrate at

Then follow the [integration guide on the developer site](https://docs.hcaptcha.com/) to add the hCAPTCHA functionality into your frontend.

This library comes in when you need to verify the user's response. On the PHP side you need the response from the hCAPTCHA service and secret key from your credentials. Instantiate the `HCaptcha` class with your secret key, specify any additional validation rules, and then call `verify()` with the hCAPTCHA response and user's IP address. For example:

```
