I am following the Laravel installation on their website and I came across this line
composer create-project laravel/laravel --prefer-dist
Now, what exactly does the --prefer-dist
part mean? I can't see anything on their documentation.
Thanks in advance.
--prefer-dist would try to download and unzip archives of the dependencies using GitHub or another API when available. This is used for faster downloading of dependencies in most cases. It doesn't download the whole VCS history of the dependencies and it should be better cached.
--prefer-dist : Reverse of --prefer-source ; composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors. It is also a way to circumvent problems with Git if you do not have a proper setup.
Via Download. Once Composer is installed, download the 4.2 version of the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer. phar install (or composer install ) command to install all of the framework's dependencies.
Before install laravel on windows. first of download composer on windows system. If you already composer download / installed Composer. go to STEP 2, Otherwise follow the steps. Click Download Composer from: www.getcomposer.org Run the setup and Install Composer.
What does --prefer-dist mean when using create-project to install laravel4? Show activity on this post. --prefer-dist: Reverse of --prefer-source; composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors.
For managing dependencies, Laravel uses composer. Make sure you have a Composer installed on your system before you install Laravel. In this chapter, you will see the installation process of Laravel.
Step 1 − Visit the following URL and download composer to install it on your system. Step 2 − After the Composer is installed, check the installation by typing the Composer command in the command prompt as shown in the following screenshot. Step 3 − Create a new directory anywhere in your system for your new Laravel project.
--prefer-dist
and --prefer-source
are the two options of composer which included in various documentations with a lack of proper explanation.
--prefer-dist
would try to download and unzip archives of the dependencies using GitHub or another API when available. This is used for faster downloading of dependencies in most cases. It doesn't download the whole VCS history of the dependencies and it should be better cached. Also archives on GitHub could exclude some files you don't need for just using the dependency with .gitattributes exclude directive.
--prefer-source
would try to clone and keep the whole VCS repository of the dependencies when available. This is useful when you want to have the original VCS repositories cloned in your vendor/ folder. E.g. you might want to work on the dependencies - modify them, fork them, submit pull requests etc. while also using them as part of the bigger project which requires them in the first place.
Simply speaking, the --prefer-source
option will prefer to create a package directory that is a "version control repository", which is equivalent to you typing:
$ git clone ...
or
$ svn checkout ...
On the other hand, the --prefer-dist
option will prefer to create a non-"version control repository", which is equivalent to you typing:
$ git clone ... ; rm -fr dir/.git
or
$ svn export ...
Remember that, these are only preferences, if a dependency is required using a VCS repository which does not provide archives such as GitHub API, then the only available option is to clone the repository.
It's all available here: https://getcomposer.org/doc/03-cli.md#install
--prefer-dist: Reverse of --prefer-source, composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors. It is also a way to circumvent problems with git if you do not have a proper setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With