php - Using Captcha with Symfony2 (2.8) -


i installed captcha bundle using following instruction:

  1. add "gregwar/captcha-bundle": "1.0.0" require section in composer.json
  2. run windows powershell in root , call php composer.phar update
  3. console outputs

warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0 loading composer repositories package information updating dependencies (including require-dev) nothing install or update generating autoload files incenteev\parameterhandler\scripthandler::buildparameters updating "app/config/parameters.yml" file sensio\bundle\distributionbundle\composer\scripthandler::buildbootstrap

warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0 sensio\bundle\distributionbundle\composer\scripthandler::clearcache

warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0

// clearing cache dev environment debug true

[ok] cache "dev" environment (debug=true) cleared.

sensio\bundle\distributionbundle\composer\scripthandler::installassets

warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0

trying install assets relative symbolic links.

        bundle                 method / error    

warning frameworkbundle copy
warning jmstranslationbundle copy

! [note] assets installed via copy. if make changes these assets have run command again.

[ok] assets installed.

sensio\bundle\distributionbundle\composer\scripthandler::installrequirementsfile sensio\bundle\distributionbundle\composer\scripthandler::preparedeploymenttarget

  1. following instruction can skip step

    // app/autoload.php  $loader->registernamspaces(array(     // ...     'gregwar' => __dir__.'/../vendor/bundles', )); 

but autoload.php files looks following:

use doctrine\common\annotations\annotationregistry; use composer\autoload\classloader;  error_reporting(error_reporting() & ~e_user_deprecated);  $loader = require __dir__.'/../vendor/autoload.php';  annotationregistry::registerloader(array($loader, 'loadclass'));  return $loader; 
  1. i enabled bundle:

    // app/appkernel.php  public function registerbundles() {     $bundles = array(         // ...         new gregwar\captchabundle\gregwarcaptchabundle(),     ); } 
  2. last instalation step add gregwar_captcha: ~ app/config/config.yml , it's done.

now i'm trying use im controller.

    public function registrationaction(request $request)     {         $user = new models\user();          $form = $this->createformbuilder($user)             ->add('username', 'symfony\component\form\extension\core\type\texttype')             ->add('birth', 'symfony\component\form\extension\core\type\datetype')             ->add('captcha', 'captcha')             ->add('save', 'symfony\component\form\extension\core\type\submittype', array('label' => 'register'))             ->getform();          $form->handlerequest($request);            return $this->render(              'cassyw2bundle:user:registration.html.twig',              array(                 'form' => $form->createview(),             )         );     } 

i error:

compile error: declaration of gregwar\captchabundle\type\captchatype::buildview() must compatible symfony\component\form\formtypeinterface::buildview(symfony\component\form\formview $view, symfony\component\form\forminterface $form, array $options) 

where did wrong?

see doc. version of symfony need version of bundle. try installing without providing version in composer.json.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -