We run our Laravel projects within Docker containers for local development, and I like to specify exact PHP extension requirements in my composer.json file.
For example, on a recent project, I made use of the openssl_encrypt and openssl_decrypt functions, so I added the ext-openssl requirement to my composer.json file.
This way, wherever the project is installed, if that extension is not available for some reason, Composer will throw an error and let me know.
The proper way to do this is to run the following command:
composer require ext-openssl
But if we forget to do that and just manually add the ext-openssl requirement to the composer.json file, the next time I run composer install, it will display a warning that the lock file is out of sync.
If I try running composer update to resolve this, it will also update the packages in the project, which I don't want to do.
Thankfully, there's another solution. To get my lock file back in sync without changing any packages, I can run the following command:
composer update --lock
This updates my lock file to be in sync with my changed composer.json file, but it doesn't make a single change to my vendor directory.
Here to help,
Joel
P.S. Is there a part of your application that is slower than you would like? We can help with that.