Composer list packages with installed version and latest version

As in the title, is there any command that can list installed packages and the latest version of those packages together?


edit:

php composer.phar show

this show all available packages and also installed packages with installed version only

php composer.phar show [package]

this can get both installed version and latest version, but it is inconvenience if many packages are installed


Solution 1:

Since Composer v1.1 (May 2016) you can run

composer outdated

Solution 2:

As the current version of composer -i option which tells composer to show only the installed version is deprecated.

So if you want to show only the installed version of a package, the syntax is:

composer show "package-name"

If you need to pull all available versions of the package, use --all option like this:

composer show "phpunit/phpunit" --all 

Solution 3:

Accordng to the docs https://getcomposer.org/doc/03-cli.md#show

composer show -l

or

composer show --latest

will "List all installed packages including their latest version"

Here are a few lines of my output:

beberlei/assert                   v2.5    v2.7.8  Thin assertion library for...
behat/transliterator              v1.1.0  v1.2.0  String transliterator
clue/stream-filter                v1.3.0  v1.4.0  A simple and modern approa...
fgrosse/phpasn1                   1.3.2   1.3.2   A PHP Framework that allow...

This worked on composer 1.2 and 1.5.2

Solution 4:

I think

php composer show -i

is what you're looking for.

Solution 5:

--outdated option

Perhaps, you are looking for --outdated option. It will make output like this:

zendframework/zend-db  2.9.2  2.9.3  Database abstraction layer, SQL...

2.9.2 2.9.3 - installed and new available version (according to instructions in composer files).

--all option

I guess it --all should work for you within one package.

It will show your current version with the asterisk. It will look like this:

dev-master, v0.1.2-alpha.0, * v0.1.1-alpha.0, v0.1.0-alpha.1, v0.1.0-alpha.0, dev-develop

So, I have installed v0.1.1-alpha.0.

--available option

Also, there is --available option to new version.

--available (-a): List available packages only.

https://getcomposer.org/doc/03-cli.md#show

Example:

composer show --available monolog/monolog 1.0.2

In this case it will make request to available composer repositories, packagist.org or your custom ones.

P.S. My GIT version: 2.14.1