Dist
$ composer install --prefer-dist
The dist is a packaged version of the package data. Usually a released version, usually a stable release.
Source
$ composer install --prefer-source
The source is used for development. This will usually originate from a source code repository, such as git. You can fetch this when you want to modify the downloaded package.
Why is it important?
Source – https://getcomposer.org/doc/05-repositories.md
…internally Composer sees every version as a separate package. While this distinction does not matter when you are using Composer, it’s quite important when you want to change it.
Packages can supply either of these, or even both. Depending on certain factors, such as user-supplied options and stability of the package, one will be preferred.
Which to use?
In terms of speed, --prefer-dist (i.e. archive) is quicker to get you started, and may exclude unnecessary/redundant files.
--prefer-source on the other hand, clones the entire repository/source instead of downloading the packages- this is useful if you want to edit the directory files.
To conclude
--prefer-dist isn’t necessary if you prefer to use dist as Composer will always default to it when downloading a stable version/dependency.
However, before deploying code to production, remember to optimize autoloader!
$ composer dump-autoload --optimize