--prefer-dist and --prefer-source are two composer options that are included in various documents with no proper explanation.
--prefer-dist will try to download and unzip the dependency archives using GitHub or another API, if any. This is used to load dependencies faster in most cases. It does not load the entire history of VCS dependencies and should be better cached. Also, archives on GitHub can exclude some files that you do not need, simply by using the dependency with the .gitattributes exclude directive.
--prefer-source will try to clone and store the entire VCS dependency repository when it is available. This is useful if you want the original VCS repositories to be cloned in your provider / folder. For instance. you may want to work on dependencies - modify them, deploy them, send requests for traction, etc., and also use them as part of a larger project that requires them in the first place.
Simply put, the --prefer-source option --prefer-source prefer to create a package directory, which is a "version control repository", which is equivalent to what you type:
$ git clone ...
or
$ svn checkout ...
On the other hand, the --prefer-dist option --prefer-dist to create a non- "version control repository", which is equivalent to what you type:
$ git clone ... ; rm -fr dir/.git
or
$ svn export ...
Remember that these are only preferences, if dependency is required using a VCS repository that does not provide archives such as the GitHub API, then the only option available is to clone the repository.
sha-1 source share