Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

InfoPeak Captcha for PHP

Server-side verification for InfoPeak Captcha - the privacy-first, EU-hosted captcha. No tracking, no cookies, no image puzzles.

Install

composer require infopeak/captcha

Requires PHP 7.4+ with the curl and json extensions.

Usage

Add the widget to your form (full guide):

<form action="/signup" method="POST">
  <input type="email" name="email" required>
  <div class="infopeak-captcha" data-sitekey="YOUR_SITEKEY"></div>
  <button type="submit">Sign up</button>
</form>
<script src="https://captcha.infopeak.io/infopeak-captcha.js" defer></script>

Verify the token when the form is submitted:

use InfoPeak\Captcha\Client;

$captcha = new Client('YOUR_SITEKEY', 'YOUR_SECRET');

if (!$captcha->verify($_POST[Client::FIELD] ?? '')) {
    http_response_code(400);
    exit('Captcha verification failed');
}
// ... proceed

Need quota information too?

$result = $captcha->verifyDetailed($_POST[Client::FIELD] ?? '');
$result->valid;     // bool - token genuine and unused
$result->overLimit; // bool - sitekey over its monthly quota

Verification fails closed: network errors and non-200 responses return valid = false.

Testing

Public test credentials that work on any domain and never count against a quota (never use in production):

sitekey: ipk_test_sitekey
secret:  ipk_test_secret

Links

License

MIT

About

PHP client for InfoPeak Captcha - privacy-first, EU-hosted. No tracking, no cookies, no puzzles.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages