定制 omasn/decaptcha-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

omasn/decaptcha-bundle

Composer 安装命令:

composer create-project omasn/decaptcha-bundle

包简介

Symfony Decaptcha bundle, распознавание капч для всех популярных сервисов rucaptcha.com, 2captcha.com, pixodrom.com, captcha24.com, socialink.ru, anti-captcha.com

README 文档

README

Symfony Decaptcha bundle.

The package is created for standardization of all services on guessing Captcha. Each service has its own characteristics and now you do not need to operate a few packages. It is enough only to familiarize with the available documentation in order to customize each. The package covers all the functionality of the services. If you do not have enough functionality, I'll be happy to hear all the suggestions. Bundle is implemented on the basis of https://github.com/jumper423/decaptcha

Choose Language

Menu

Services

Captcha Recognition for all popular services

Installation

Get the bundle

Let Composer download and install the bundle by running

Or you can run

composer require omasn/decaptcha-bundle "*"

or add

"omasn/decaptcha-bundle": "1.1.*"

in file composer.json.

Enable the bundle

// in app/AppKernel.php
public function registerBundles() {
	$bundles = [
		...
		new Omasn\DecaptchaBundle\DecaptchaBundle(),
	];
	...
}

Configuration bundle

Configure api_key for those Captcha Recognition services that you want to use.

# app/config/config.yml
omasn_decaptcha:
    ru_captcha:
        api_key: '%api_key%'
    anticaptcha:
        api_key: '%api_key%'
    captcha_24:
        api_key: '%api_key%'
    pixodrom:
        api_key: '%api_key%'
    ripcaptcha:
        api_key: '%api_key%'
    socialink:
        api_key: '%api_key%'
    two_captcha:
        api_key: '%api_key%'

Usage

A small example of how on the basis of the RuCaptcha service to get your current balance in the system and by the available url to recognize the captcha. For more information on usage, see Documentation

Example in the controller action

// src/AppBundle/Controller/DefaultController.php
...
public function indexAction()
{
    $oReCapcha = $this->get('decaptcha.ru_captcha');
    $iBalance = $oReCapcha->getBalance();
    ...
    if ($oReCapcha->recognize('http://site.ru/captcha.jpg')) {
        $code = $oReCapcha->getCode();
        if (!$myApp->validCode($code)) {
            $oReCapcha->notTrue(); // not valid code request in api
        }
    } else {
        $error = $oReCapcha->getError();
    }
}
...

Using an additional configuration

Add additional parameters to the RuCaptcha configuration "Description of fields"

// src/AppBundle/Controller/DefaultController.php

use Omasn\DecaptchaBundle\Services\RuCaptcha;

...
public function indexAction()
{
    $oReCapcha = $this->get('decaptcha.ru_captcha');
    $oReCapcha->setParams([
        RuCaptcha::ACTION_FIELD_FILE => '/file/to/path',
    ]);
}
...

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固