npmcomposer-phpbower

NPM/Bower/Composer - differences?


Can someone explain to me the difference between NPM, Bower and Composer.

They are all package managers - correct?

But when should each one be used?

Also, each one appears to have a json file that accompanies it, does this store all the packages you require so they can be installed by cmd line? Why do you need this file?


Solution

  • [update, four years later]

    [original answer]

    npm is nodejs package manager. It therefore targets nodejs environments, which usually means server-side nodejs projects or command-line projects (bower itself is a npm package). If you are going to do anything with nodejs, then you are going to use npm.

    bower is a package manager that aims at (front-end) web projects. You need npm and nodejs to install bower and to execute it, though bower packages are not meant specifically for nodejs, but rather for the "browser" environment.

    composer is a dependency manager that targets php projects. If you are doing something with symfony (or plain old php), this is likely the way to go

    Summing it up:

    And yes, the "json" files describe basic package information and dependencies. And yes, they are needed.

    Now, what about the READMEs? :-)