gyCaptchaPlugin - 1.0.4

YELLOcaptcha - image based captcha symfony plugin

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source

gyCaptcha plugin (YELLOcaptcha)

The gyCaptchaPlugin is a symfony plugin that provides innovative approach in form validation with captcha (YELLOcaptcha).

Main interest for developers are widget and validator classes which ready to be used in symfony forms.

Basic Usage

  • Enable the gyCaptcha module in settings.yml file of your application. gyCaptcha was given simple task of displaying the captcha images.

        enabled_modules: [default, gyCaptcha]
  • Publish plugin assets. It's required to use javascript bundled with the plugin. It provides image selection functionality. Attached stylesheet is optional.

    $ ./symfony plugin:publish-assets
  • Create form class including captcha widget and validator.

    class myContactForm extends sfForm
      public function configure()
          'name'    => new sfWidgetFormInput(),
          'email'   => new sfWidgetFormInput(),
          'message' => new sfWidgetFormTextarea(),
          'captcha' => new gyWidgetFormCaptcha(array('size' => 5, 'valid' => 2))
          'name'    => new sfValidatorString(),
          'email'   => new sfValidatorEmail(),
          'message' => new sfValidatorString(),
          'captcha' => new gyValidatorCaptcha()
  • Use your form in action as usually. Don't forget to add related javascript and css files to the response.

    class captchaActions extends sfActions
      public function executeIndex(sfWebRequest $request)
        $this->form = new myContactForm();
        if ($this->getRequest()->isMethod('post'))
          if ($this->form->isValid())
      public function executeShowMessage(sfWebRequest $request)
  • Create template for displaying the form and confirmation message.

  • Clear your cache.

    $ ./symfony cc