Join my Vue.js course while it's free 👀

Install packages from the Composer lock file

May 3, 2022  ‐ 1 min read

When coming from a Node.js environment you're probably familiar with lock files, whether it's the package-lock.json or yarn.lock file.

To install the exact packages as specified in your composer.lock file you should run:

$ composer install

If the composer.lock file isn't present then one is generated as part of the install command.

To upgrade package versions, which will update your composer.lock file, you should run:

$ composer upgrade

Installing packages from your lock file ensures that you get exactly the same dependency versions as specified in the lock file.

In a Node.js environment you need to use a separate command or a command argument to install packages from your lockfile, depending on whether you use npm or yarn.

With composer this is the default behavior for the install command.