Composer quick start guide

The most common composer commands that you will use on a daily basis....

On a daily basis you get to use only a few of the many commands that Composer has and therefore you should know what each of them do so that you can get your thing done.

The list is as follows:

  • composer self-update - ALWAYS keep your composer up to date
  • composer install - this command installs the dependencies as described in composer.lock
  • composer update - this updates ALL your packages
  • composer update vendor/package - this installs new package

Although composer update is rarely used in the real world as you rarely have to go berserk and update every dependency, I have included it here because it's a very common rookie mistake to use it when trying to install a new package and this needs to stop.

Additionally, the composer install and composer update commands have a few parameters that you can use. The most common ones are:

  • --prefer-dist - basically, this makes composer download zips files instead cloning repos, useful for very very big git repos that cause your process to timeout
  • -v / -vv / -vvv - this increases the verbosity level

Before saying goodbye, I'd like to present you a couple of examples:

  • composer update tss/automailer-bundle
  • composer update tss/automailer-bundle --prefer-dist
  • composer update tss/automailer-bundle --prefer-dist -vvv

The above commands should get you through your usual day without any major problems.

Have fun coding :)

Want more awesome stuff?

Check us out on our Medium Remote Symfony Team publication.