This is a comment on Composer Guide for Beginners, posted by WikiAdmin at 06/06/2026 23:23

View source for Difference between --prefer-dist and --prefer-source

The difference lies in **how** Composer retrieves the package files:
  *   **##--prefer-dist## (Distribution):** Downloads a **clean archive** (ZIP/TAR) of the package.
    *   **Best for:** Production, CI/CD pipelines, and standard development.
    *   **Pros:** Significantly **faster** installation, smaller disk footprint, and excludes development files (like tests/docs) if the maintainer configured ##.gitattributes## correctly.
    *   **Default:** This is the automatic default for stable tagged versions.
  *   **##--prefer-source## (Source):** Clones the **full version control repository** (e.g., ##git clone##).
    *   **Best for:** Contributing to a package, debugging deep into a dependency, or needing the commit history.
    *   **Pros:** Gives you the ##.git## folder inside ##vendor/##, allowing you to modify code, switch branches, or submit pull requests directly from the dependency.
    *   **Cons:** Slower download and includes the entire history and potentially unwanted files.

**Summary:** Use ##--prefer-dist## for speed and stability in 99% of cases. Use ##--prefer-source## only when you intend to **modify** the dependency's code directly.