100

I want to get list of outdated packages that will be updated when I issue composer update. Does composer have such functionality? if no is there a way to do that (with or without composer?)

0

3 Answers 3

176

Update:

Since Composer v1.1 (May 2016) the following commands are available:

  • composer outdated shows you the list of outdated packages
  • composer show -l returns the complete list of packages. packages in need of update are colored red. the (still) up-2-date ones are colored green.
  • both commands accept the parameter --direct to show only direct dependencies in the listing

Referencing:

https://github.com/composer/composer/issues/3771


Composer Plugins

There are some Composer Plugins showing the list of outdated packages:

  1. composer-versions-check - https://github.com/Soullivaneuh/composer-versions-check

    The Composer Plugin called "composer-versions-check" shows outdated packages from last major versions after using the update command. (Latest is ..)

    This plugin runs "update" first, then shows possible "upgrade" indications.

    A Composer dry-run isn't supported, yet.

    Composer-Version-Check-Plugin

  2. vinkla/climb - https://github.com/vinkla/climb

    Climb is a "Composer version manager tool" inspired by npm-check-updates.

    It shows the outdates package version and indicates "upgrades" to latest versions.

7
  • "When you execute update the packages are installed" Which packages do you refer here? Since update should update only packages I installed with install? Commented Nov 5, 2015 at 11:35
  • Yes, the packages defined in your composer.json file. First you install, then you can update several times, right? For instance, when you define a requirement of package-A with version 1.2.* and run install or update - it will only fetch a version in the MINOR.PATCH_LEVEL version range. It will never grab the latest version (when this package-A has a version 2.0.0) or grab version 1.3, 1.4, etc. And then you will get the message that you are using an outdated package (not the latest version) and that the latest version is 2.0.0. Commented Nov 5, 2015 at 11:44
  • Now I want something that will check versions without doing actual update, some kind of dry check. Commented Nov 5, 2015 at 11:49
  • 4
    Maybe add this plugin and use composer update --dry-run. Commented Nov 5, 2015 at 11:55
  • --dry-run doesn't work so far see here: github.com/Soullivaneuh/composer-versions-check/issues/24
    – Pᴇʜ
    Commented Nov 9, 2015 at 9:21
29

Since version 1.1 of Composer there is the composer outdated command. With composer outdated --direct only your direct dependencies are taken into account.

12

To complete @jens-a-koch response, get any dependency update:

composer outdated

or get only direct dependencies from your composer.json:

composer outdated -D

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

outdated

The outdated command shows a list of installed packages that have updates available, including their current and latest versions. This is basically an alias for composer show -lo.

The color coding is as such:

  • green (=): Dependency is in the latest version and is up to date.
  • yellow (~): Dependency has a new version available that includes backwards compatibility breaks according to semver, so upgrade when you can but it may involve work.
  • red (!): Dependency has a new version that is semver-compatible and you should upgrade it.

Options

  • --all (-a): Show all packages, not just outdated (alias for composer show -l).
  • --direct (-D): Restricts the list of packages to your direct dependencies.
  • --strict: Returns non-zero exit code if any package is outdated.
  • --minor-only (-m): Only shows packages that have minor SemVer-compatible updates.
  • --format (-f): Lets you pick between text (default) or json output format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.