alexlegard's avatar

Procedure for updating packages

Since I have a few packages that need updating, I thought I'd clear up this question now and in the future.

  1. What are some useful composer commands (eg. to find out which packages are out of date?)
  2. What's a good procedure to update packages? Will "composer update" suffice?
  3. What to do differently when updating a project in production environment?
  4. Any recommended videos here on Laracasts about this topic?
0 likes
3 replies
xdimension's avatar
Level 5
  1. You can see the available commands by running 'composer'. It's 'composer outdated'. But I rarely use this command, as we concern only with 2 things, the development environment and production (see the next points).
  2. Yup, 'composer update', that's what we do in the development env, don't do this in production, why? this would update the composer.lock, which the composer will use for reference to determine the exact version of packages when we call 'composer install'.
  3. As mentioned in point 2, so, in the production we only need to run 'composer install' to instruct the composer to install the packages according to what was registered in composer. lock.

For a more complete guide, see here: https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies

1 like
Snapey's avatar

The problem with composer update is that all packages are updated.

Your composer.json will usually prevent you from accidentally applying breaking changes, but it could.

Unless you have time to focus on multiple packages being upgraded at once (and not knowing which one broke your app), you may prefer a more conservative approach and update one package at a time by specifying the package name

Please or to participate in this conversation.