Package Manager vs Dependency Manager

2019-03-08 19:55发布

问题:

What are the differences?

In many places they used interchangeably as synonyms but I think they are different. What is the key difference in short?

回答1:

Package Manager is used for SYSTEM and Dependency Manager for PROJECT


PACKAGE MANAGER

is used to configure system, ie to setup your development environment and with these settings you can build many projects.

DEPENDENCY MANAGER

Is specific to project. You manage all dependencies for a single project and those dependencies are going to be saved on your project. When you start another project you should manage your dependencies again.


Example: In PHP world there is COMPOSER as dependency manager and PEAR as package manager. When using composer all your settings and extensions are for single project where pear settings to setup new extension and library to php core.



回答2:

There is an excellent and simple explanation on Composer's website:

Composer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it does not install anything globally. Thus, it is a dependency manager.