mohammadv184 / arcaptcha
PHP library for ArCaptcha
Installs: 1 353
Dependents: 1
Suggesters: 2
Security: 0
Stars: 10
Watchers: 2
Forks: 3
Open Issues: 3
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-11-19 23:10:40 UTC
README
PHP library for ArCaptcha.
This package supports PHP 7.3+
.
List of contents
Installation
Require this package with composer:
composer require mohammadv184/arcaptcha
Configuration
You can create a new instance by passing the SiteKey and SecretKey from your API. You can get that at https://arcaptcha.ir/dashboard
use Mohammadv184\ArCaptcha\ArCaptcha; $ArCaptcha = new ArCaptcha($siteKey, $secretKey);
How to use
How to use ArCaptcha.
Widget usage
To show the ArCaptcha on a form, use the class to render the script tag and the widget.
<?php echo $ArCaptcha->getScript() ?> <form method="POST"> <?php echo $ArCaptcha->getWidget() ?> <input type="submit" value="Submit" /> </form>
Verifying a response
After the post, use the class to verify the response. You get true or false back:
if ($ArCaptcha->verify($_POST["arcaptcha-token"])) { echo "OK!"; } else { echo "FAILED!"; }
Credits
License
The MIT License (MIT). Please see License File for more information.