blackcube/lockbot
最新稳定版本:1.1.0
Composer 安装命令:
composer require blackcube/lockbot
包简介
PHP version of Lockbot Captcha
README 文档
README
Installation
If you use Packagist for installing packages, then you can update your composer.json like this :
{
"require": {
"blackcube/lockbot": "*"
}
}
Testing
To run the tests:
composer install ./vendor/bin/codecept build ./vendor/bin/codecept run
To check coverage report:
./vendor/bin/codecept run --coverage --coverage-html
Usage
Captcha class allows you to generate and verify POW CAPTCHA codes.
Generating CAPTCHA Codes
use blackcube\lockbot\Captcha; $captcha = new Captcha(); $challenge = $captcha->generateChallenge(); // Generate a CAPTCHA challenge // $challenge is an array with 'algorithm' and 'salt' and 'hash' keys // ['algorithm' => 'sha256', 'salt' => 'random_salt', 'hash' => 'computed_hash']
Verifying CAPTCHA Codes
// $solution is the solution provided by the user ['salt' => 'challenge_salt', 'hash' => 'challenge_hash', 'algorithm' => 'challenge_algorithm', 'solution' => 'user_solution'] use blackcube\lockbot\Captcha; $captcha = new Captcha( algorithm: $solution['algorithm'] // Use the same algorithm as the challenge); ); $isValid = $captcha->verifySolution($solution['salt'], $solution['hash'], $solution['solution']); // Verify the provided solution
Main methods are:
- Generate a CAPTCHA challenge
generateChallenge(): array- Verify a provided solution
verifySolution(string $salt, string $hash, string $solution): bool
Contributing
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
Fork the project, create a feature branch , and send us a pull request.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-08-28