What is the difference between the prefer-dist and prefer-source options in Composer?

3

In Composer, when we are going to install the library, we can add as options the argument --prefer-source or --prefer-dist .

I would like to know what each one does and / or if there is a difference between the two.

Example

 composer install --prefer-dist

Example:

composer install --prefer-source
    
asked by anonymous 22.05.2018 / 20:42

2 answers

1
  

I would like to know what each one does and / or if there is a difference between   both.

These options refer to how the composer will download and manage the dependencies within your vendor directory.

--prefer-dist will give preference to the distribution package of that dependency if available. This is the default option if you are referencing in your composer.json a stable version of that package.

For example, when creating a tag and a release within a GitHub repository. This tag will have a corresponding zip for that version and from that zip the composer will install its dependency. This option is the fastest to install.

--prefer-source will give preference to downloading the source code repository itself, making a git clone of that repository. This option is interesting if you are working with a developing package and want to update the content with vendor later. It is slower because in addition to the application code, the project repository is also downloaded.

More information can be found at composer documentation at .     

01.06.2018 / 19:18
1

- prefer-dist would be the distribution version, a version of the product, a stable, for example.

- prefer-source would be like downloading the source code for that project, the latest code, a product development version.

    
26.05.2018 / 04:56