# Lock file

> A lock file records the exact versions of all packages installed in a project, so that every installation ends up in the same state; with Composer it is composer.lock.

Original page: https://t10.de/en/glossary/lock-file
Publisher: total10 GmbH, https://t10.de/en/glossary

While composer.json sets out which package versions a project allows, the lock file records the versions that were actually chosen. Running `composer update` resolves suitable versions for every dependency in composer.json. The command then writes each package and its exact version to composer.lock, locking the project to those versions. Once a lock file exists, `composer install` uses exactly those versions. Newer versions come in only with an explicit update.

The [Composer documentation on basic usage](https://getcomposer.org/doc/01-basic-usage.md) recommends committing composer.lock to version control. The CI server, the production machines and the other developers on the team then all use the same dependency versions. A tip in the same documentation suggests keeping the `vendor` directory, with all its third-party code, out of version control.

The current documentation recommends committing the lock file for libraries too, that is, packages that other projects use. Among other things, this can help stop supply chain attacks from spreading. A library's lock file, however, has no effect on the projects that use that library.

We check the lock file that ships with Shopware 5 against known security advisories. For the dependencies we have updated, we keep a lock file of our own. It belongs to our own Composer manifest, the separate file that sits beside the shipped composer.json.

## See also

- [Composer](https://t10.de/en/glossary/composer): Composer is a tool for dependency management in PHP: a project declares the libraries it depends on, and Composer installs and updates them.
- [Dependency](https://t10.de/en/glossary/dependency): A dependency is a third-party software package that a project builds on and needs in order to run; packages required by a dependency count as dependencies too.
- [Repository](https://t10.de/en/glossary/repository): A repository (on GitHub, for example) holds a software project with all its files, its documentation and the revision history of every file.

## Sources

1. [Composer Documentation: Basic usage](https://getcomposer.org/doc/01-basic-usage.md), Composer (getcomposer.org), accessed 2026-11-16
2. [Composer Documentation: Libraries](https://getcomposer.org/doc/02-libraries.md), Composer (getcomposer.org), accessed 2026-11-16
