During development (multiple people in the team) sometimes composer install
returns:
Warning: The lock file is not up to date with the latest change
For composer < 1.3.0
Yes, there is a way to check for this very quickly.
The "out-of-date" check is based on a hash of the composer.json
contents, stored in the composer.lock
. There's no salt, and it's a straight-forward hash of the contents, so it's very, very easy to do.
hash;
$json = md5(file_get_contents('composer.json'));
if ($lock !== $json) {
echo "Lock file out of date\n";
exit(1);
}
echo "Lock file up to date\n";
exit(0);