From the course: Learning Composer, the PHP Dependency Manager

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

The purpose of composer.lock

The purpose of composer.lock

From the course: Learning Composer, the PHP Dependency Manager

Start my 1-month free trial

The purpose of composer.lock

- [Instructor] To ensure Composer stays true to your versioning instructions, a file called composer.lock is created when you start installing packages. To see what this file does and how versioning works in practice, let's install another package. This time, we'll deliberately install an older version of a common package for logging called monolog, so we can look at updating and managing versions later on. Monolog has a lot of versions available, and in this example, I want to use version 1.17.0. To install monolog, go to the command line, go to the project folder, and then type in: composer require monolog/monolog. And then I want a specific version, so I'll say :1.17.0. Hit return and the composer package is downloaded off the web and installed into my site, along with its dependencies. When the installation is complete, I can go back to my project. Here you now see, under composer.json, I have require league/color-extractor and also monolog/monolog and the version 1.17.0, and if I…

Contents