sfReCaptchaLibPlugin - 1.4.0

Integrate reCAPTCHA with Symfony PHP framework

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfReCaptchaLibPlugin 1.4.0

This plug-in is a port of recaptchalib 1.11 to the Symfony PHP framework. It features improved error handling and better integration than the other reCAPTCHA plug-in provides.

Configuration

The plug-in looks in app.yml for your reCAPTCHA API keys:

all:
  sf_recaptcha_plugin:
    public_key: [your public key goes here]
    private_key: [your private key goes here]

Usage

Integrating reCAPTCHA with this plug-in is easy.

In your action:
$this->recaptcha = new reCaptcha();
if($request->getMethod() == sfRequest::POST)
{
    $this->recaptcha->checkAnswer($request);
    if($this->recaptcha->isValid())
        // ...
}

In your view:
<?php echo $recaptcha->getHTML(ESC_RAW) ?>

Other notes

I'm not completely sure what should be returned by the mailhideUrl() method in the case of an error. Right now, it currently returns an empty string.