composer: How to find the exact version of a package? composer: How to find the exact version of a package? php php

composer: How to find the exact version of a package?


I know it's an old question, but...

composer.phar show

Will show all the currently installed packages and their version information. (This was shown in previous versions of Composer only when using the now-deprecated -i option.)

To see more details, specify the name of the package as well:

composer.phar show monolog/monolog

That will show many things, including commit MD5 hash, source URL, license type, etc.


You can use composer show like this:

composer show package/name


If you're just interested to get the output as the package version number like: 1.7.5 or 1.x-dev or dev-master.

Linux console snippet (composer & sed):

composer show 'monolog/monolog' | sed -n '/versions/s/^[^0-9]\+\([^,]\+\).*$/\1/p'

or (composer, grep & cut):

composer show 'monolog/monolog' | grep 'versions' | grep -o -E '\*\ .+' | cut -d' ' -f2 | cut -d',' -f1;