Get the list of available updates for PHP dependencies using Composer

These commands show a list of installed packages that have updates available.

If you have a PHP application, and you use Composer as the package manager, then this article is for you.

While developing your applications, you might want to see the list of the packages that have available updates, so that you can easily check if you want to update them.

To do so, you can run either of these commands (They’re both the same):

composer outdatedcomposer show -lo

However, these commands return available updates for all your dependencies. You can simply use --direct or -D to restrict updates only for your direct dependencies.

In the output, you will get three colors: green, yellow, and red indicating:

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.

There are also other options to use with this command like:

--minor-only
--no-dev
--locked

For the full list, you can check the Composer documentation.

I hope this simple article helps you to keep your apps up to date. If you liked this article, please share it with your friends.

Backend developer