Install laravel --prefer-dist

I am following the installation of Laravel on my website and I came across this line

composer create-project laravel/laravel --prefer-dist

Now, what exactly does the --prefer-dist part --prefer-dist ? I do not see anything in their documentation.

Thanks in advance.

+6
source share
2 answers

All this is available here: https://getcomposer.org/doc/03-cli.md#install

- prefer-dist:. The reverse is --prefer-source, the composer will install with dist, if possible. This can speed up the installation significantly on the assembly of servers and other use cases in which vendor updates are usually not performed. This is also a way to get around git issues if you do not have the proper setup.

+7
source

--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.

+20
source

Source: https://habr.com/ru/post/975944/


All Articles