1

I installed Captcha bundle using this following Instruction:

  1. Add "gregwar/captcha-bundle": "1.0.0" to require section in composer.json
  2. Run Windows PowerShell in root and call php composer.phar update
  3. Console outputs

Warning: PHP Startup: Unable to 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 with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files Incenteev\ParameterHandler\ScriptHandler::buildParameters Updating the "app/config/parameters.yml" file Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

Warning: PHP Startup: Unable to 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 to load dynamic library 'C:\xampp\php\ext\php_yaml.dll' - Nie mo┐na odnalečŠ okreťlonego modu│u. in Unknown on line 0

// Clearing the cache for the dev environment with debug true

[OK] Cache for the "dev" environment (debug=true) was successfully cleared.

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets

Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_yaml.dll' - Nie mo┐na odnalečŠ okreťlonego modu│u. in Unknown on line 0

Trying to install assets as relative symbolic links.

 Bundle Method / Error 

WARNING FrameworkBundle copy
WARNING JMSTranslationBundle copy

! [NOTE] Some assets were installed via copy. If you make changes to these assets you have to run this command again.

[OK] All assets were successfully installed.

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget

  1. Following instruction I can skip this step

    // app/autoload.php $loader->registerNamspaces(array( // ... 'Gregwar' => __DIR__.'/../vendor/bundles', )); 

but my 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 is add gregwar_captcha: ~ to app/config/config.yml and it's done.

Now I'm trying to use it im my 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 get error:

Compile Error: Declaration of Gregwar\CaptchaBundle\Type\CaptchaType::buildView() must be compatible with Symfony\Component\Form\FormTypeInterface::buildView(Symfony\Component\Form\FormView $view, Symfony\Component\Form\FormInterface $form, array $options) 

Where did I wrong?

3 Answers 3

1

See Doc. For your version of symfony you need another version of this bundle. Try installing it without providing version in composer.json.

Sign up to request clarification or add additional context in comments.

2 Comments

I change version to 2.0.0 and run composer update. It downloads v1.1.1 but it works ;-)
As I see, you don't even need to provide any version - in this case (as I understand) latest commit from master will be cloned.
0

According to the warning, try to install the php_yaml extension by downloading this from the PEAR's sitweb https://pecl.php.net/package/yaml.

Choose the stable version and copy the dll when extracted to **C:\xampp\php\ext**

1 Comment

Thanks :-) Trust me, I've try all possible version of this dll files. This warning displays everytime when I call php in console but YAML works properly. Any idea why?
0

https://github.com/symfony/symfony/blob/2.7/UPGRADE-2.1.md#form

If you check Upgrade docs which version related Symfony 2.1 FormTypeInterface changed and it is a BC break which used in https://github.com/Gregwar/CaptchaBundle/blob/v1.0.0/Type/CaptchaType.php

So Symfony 2.8 is not compatible with this bundle version 1.0.0 There is version 2.0 tagged, please use this and if there is still problem open another question.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.