weijiajia/decrypt-verification-code
Composer 安装命令:
composer require weijiajia/decrypt-verification-code
包简介
A PHP package for decoding CAPTCHA verification codes using the jfbym.com cloud service API
README 文档
README
A PHP package for decoding CAPTCHA verification codes using the jfbym.com cloud service API.
Description
This package provides a simple interface for decrypting various types of verification code images by leveraging the jfbym.com API. It uses the Saloon HTTP client library for making API requests and handling responses.
Installation
You can install the package via composer:
composer require weijiajia/decrypt-verification-code
Requirements
- PHP 8.0 or higher
- Saloon HTTP client
- A valid API token from jfbym.com
Usage
Basic Usage
use Weijiajia\DecryptVerificationCode\CloudCode\CloudCodeConnector; // Create a new connector instance $connector = new CloudCodeConnector(); try { // Decode a verification code $response = $connector->decryptCloudCode( token: 'your-api-token', type: 'captcha-type-code', // Specific type code for the CAPTCHA format image: 'base64-encoded-image-data' // Base64 encoded image data ); // Get the decoded verification code $code = $response->getCode(); echo "Decoded CAPTCHA: " . $code; } catch (DecryptCloudCodeException $e) { // Handle API-specific errors echo "API Error: " . $e->getMessage() . " (Code: " . $e->getCode() . ")"; } catch (\Exception $e) { // Handle other exceptions echo "Error: " . $e->getMessage(); }
Response Structure
The API response is mapped to a CloudCodeResponse object with the following structure:
CloudCodeResponse {
public string $msg,
public int $code,
public Data $data {
public int $code,
public string $data, // The decoded verification code
public float $time,
public string $unique_code
}
}
With Logging
The connector supports logging functionality via the HasLogger trait:
use Psr\Log\LoggerInterface; use Weijiajia\DecryptVerificationCode\CloudCode\CloudCodeConnector; // Create a PSR-3 compatible logger $logger = /* your PSR-3 logger */; // Create a connector with logging $connector = new CloudCodeConnector(); $connector->setLogger($logger); // Now API requests and responses will be logged $response = $connector->decryptCloudCode( token: 'your-api-token', type: 'captcha-type-code', image: 'base64-encoded-image-data' );
Error Handling
The package throws a DecryptCloudCodeException when the API returns an error. The exception includes the error message and code from the API response.
try { $response = $connector->decryptCloudCode(/* ... */); } catch (DecryptCloudCodeException $e) { // API returned an error echo "API Error: " . $e->getMessage() . " (Code: " . $e->getCode() . ")"; } catch (JsonException $e) { // JSON parsing error echo "JSON Error: " . $e->getMessage(); } catch (RequestException $e) { // Request failed echo "Request Error: " . $e->getMessage(); } catch (FatalRequestException $e) { // Fatal request error echo "Fatal Request Error: " . $e->getMessage(); }
API Reference
CloudCodeConnector
decryptCloudCode(string $token, string $type, string $image): CloudCodeResponseInterface
Sends a request to the jfbym.com API to decode a verification code image.
Parameters:
$token- Your API authentication token$type- The type code that specifies the CAPTCHA format$image- Base64 encoded image data
Returns:
- A
CloudCodeResponseInterfaceobject containing the decoded verification code
License
This package is open-sourced software licensed under the MIT license.
Credits
- [Author Name]
- [All Contributors]
weijiajia/decrypt-verification-code 适用场景与选型建议
weijiajia/decrypt-verification-code 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「captcha」 「decode」 「verification」 「jfbym」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 weijiajia/decrypt-verification-code 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 weijiajia/decrypt-verification-code 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 weijiajia/decrypt-verification-code 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
AMWSCAN (Antimalware Scanner) is a php antimalware/antivirus scanner console script written in php for scan your project. This can work on php projects and a lot of others platform.
Encode integer IDs using a preset or customized symbol set
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Two Captcha
A PSR-7 compatible library for making CRUD API endpoints
Laravel 5 Securimage helper
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-08