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. [yml] all: .settings: 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. [php] class myContactForm extends sfForm { public function configure() { $this->setWidgets(array( 'name' => new sfWidgetFormInput(), 'email' => new sfWidgetFormInput(), 'message' => new sfWidgetFormTextarea(), 'captcha' => new gyWidgetFormCaptcha(array('size' => 5, 'valid' => 2)) )); $this->setValidators(array( 'name' => new sfValidatorString(), 'email' => new sfValidatorEmail(), 'message' => new sfValidatorString(), 'captcha' => new gyValidatorCaptcha() )); $this->getWidgetSchema()->setNameFormat('contact[%s]'); } } * Use your form in action as usually. Don't forget to add related javascript and css files to the response. [php] class captchaActions extends sfActions { public function executeIndex(sfWebRequest $request) { $this->form = new myContactForm(); $this->getResponse()->addJavascript('/gyCaptchaPlugin/js/gyCaptcha.js'); $this->getResponse()->addStylesheet('/gyCaptchaPlugin/css/gyCaptcha.css'); if ($this->getRequest()->isMethod('post')) { $this->form->bind($this->getRequest()->getParameter($this->form->getName())); if ($this->form->isValid()) { $this->redirect('captcha/showMessage'); } } } public function executeShowMessage(sfWebRequest $request) { } } * Create template for displaying the form and confirmation message. * Clear your cache. $ ./symfony cc