widerplan/hcaptcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

widerplan/hcaptcha

最新稳定版本:v1.0.0

Composer 安装命令:

composer require widerplan/hcaptcha

包简介

hCaptcha API client

README 文档

README

Usage

Basic

With php-http/discovery installed this package will be leveraged to attempt to use the most appropriate implementations of PSR-7 and PSR-18.

composer require widerplan/hcaptcha php-http/discovery
<?php

declare(strict_types=1);

use WiderPlan\Hcaptcha\Client;

$client = Client::create(getenv('HCAPTCHA_SECRET'));
$result = $client->verify($_POST['h-captcha-response'], getenv('HCAPTCHA_SITE_KEY'));

if ($result->success) {
    // Perform protected action...
}

With custom components

Instead of relying on the automatic discovery you can wire up your chosen implementations.

composer require widerplan/hcaptcha symfony/http-client slim/psr7
<?php

declare(strict_types=1);

use Slim\Psr7\Factory;
use Symfony\Component\HttpClient\Psr18Client;
use WiderPlan\Hcaptcha\Client;

$httpClient = new Psr18Client(
    null,
    new Factory\ResponseFactory(),
    new Factory\StreamFactory(),
);
$client = Client::create(getenv('HCAPTCHA_SECRET'), $httpClient);
$result = $client->verify($_POST['h-captcha-response'], getenv('HCAPTCHA_SITE_KEY'));

if ($result->success) {
    // Perform protected action...
}

统计信息

  • 总下载量: 1.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-29