Laz
Laz

Reputation: 669

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

Upvotes: 66

Views: 81860

Answers (7)

ds00424
ds00424

Reputation: 1348

According 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

Upvotes: 61

Mike Godin
Mike Godin

Reputation: 3937

To just show top-level packages (listed in composer.json), I use:

composer show -t | grep -v "[|\`]--" | grep -v "[└├]"

Upvotes: 0

Kirby
Kirby

Reputation: 3107

--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

Upvotes: 9

Tagarikdi Djakouba
Tagarikdi Djakouba

Reputation: 428

use this:

composer update --dry-run

it gives both your current versions and the latest versions of your bundles

Upvotes: 4

daker
daker

Reputation: 3540

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

composer outdated

Upvotes: 62

Amaynut
Amaynut

Reputation: 4271

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 

Upvotes: 49

tabacitu
tabacitu

Reputation: 6193

I think

php composer show -i

is what you're looking for.

Upvotes: 13

Related Questions