Reflection Exception - Composer update (Yii2)

I’m trying to implement recaptcha for my project written in PHP and Yii2 and I’m using himiklab’s widget. I tried to follow the steps mentioned in the Readme File but I couldnt get it working.

I tried adding the widget rule in composer.json file and did a composer update on terminal and I see this as below.


  Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist  




  Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository::whatProvides(Compose  

  r\DependencyResolver\Pool $pool, $name) should be compatible with Composer\Repository\ComposerRep  

  ository::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypassFilters = false)

I even tried to install it using composer using composer require --prefer-dist "himiklab/yii2-recaptcha-widget" "*" and I get the same error as above image.

My code: Signup form.php

 public function rules() { 

    return [ ... 

  [['reCaptcha'],\himiklab\yii2\recaptcha\ReCaptchaValidator::SignupForm(), 'secret' => 'secretkey', 'uncheckedMessage' => 'Please confirm that you are not a bot.'] 



signup.php (view)

<?= $form->field($model, 'reCaptcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::SignupForm(),['siteKey' => 'sitekey']) ?>


return [ 

'components' => [ 'reCaptcha' => [ 'name' => 'reCaptcha', 'class' => 'himiklab\yii2\recaptcha\ReCaptcha', 'siteKey' => 'siteKey', 'secret' => 'secretKey', ], 



When I ignored the installation of widget using composer and continued with adding the widget in composer.json file "himiklab/yii2-recaptcha-widget" : "*" and running the application, I see the error mentioned in the heading.

Did anyone face the same issue? Can someone help me in solving this. TIA

1/ Clear all composer cache.

2/ Remove vendor dir.


composer clearcache

Tried clearing the cache using the above code but it is also throwing the same error.

General doubt.

Does this not effect the functioning of the website? (because if it doesnt work while I try to re-install all the composer dependencies, it will be problem right? )

And what is composer.lock? Do I have to delete that as well if step 1 works and I reach step 2?

Clear it manually. Command composer clearcache could help to show paths.

In normal way site will work. The vendor directory should never be touched manually.

Don’t worry about composer.lock in this case.

Cannot see any path for the cache. It directly shows the error message as above

In the first reply, you asked me to delete the vendor dir. So is there any safe way to do so?


  2. Yes. ‘Delete’ button on your keyboard.