Install isolated Yii2 extension without updating other packages.

The tips here are for advanced usages of composer and its assumed you have read about using composer and have a knowledge of your vendor packages to be updated. Let’s consider, a scenario where you do not want composer to update all your packages. Instead, you want to update only a specific yii2 vendor extension, without updating all the other extension packages?

STEP 1: Update single vendor package only

Let’s say the package name is vend/pkg. Run the following command.

php composer.phar update vend/pkg

This will only install or update the vend/pkg extension (plus its dependencies) and overwrite the composer.lock.

STEP 2: Update composer.lock

When you do step 1, you should most likely receive a warning message like below


The lock file is not up to date with the latest changes in `composer.json`, you may be getting outdated dependencies, run update to update them.

Do not worry. This is a message you should expect similar to when you edit the composer.json file. Composer detects a change to the md5sum of the file and warns you if this hash differs from the one stored in the composer.lock.

To proceed further, just update the lock file with the following command:

php composer.phar update --lock

Thus, composer will bring your composer.lock file up to date but NOT UPDATE all your other Yii2 vendor packages.

One thought on “Install isolated Yii2 extension without updating other packages.

  1. Hello, I am new to Yii 2 framwork and I got following error when i have downloaded “kartik-v/yii2-export”: “*” via composer…

    Warning: mb_strlen() expects parameter 1 to be string, array given in /var/www/My-application/vendor/yiisoft/yii2/helpers/BaseStringHelper.php on line 29

    Warning: str_pad() expects parameter 1 to be string, array given in /var/www/My-application/vendor/yiisoft/yii2/web/Request.php on line 1281
    Unknown Method – yii\base\UnknownMethodException
    Calling unknown method: yii\web\UrlManager::addRules()

    How can i remove this error. I want to export csv file with progressbar.
    Can i download it without using composer also…??

Comments are closed.