Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing laravel --prefer-dist

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.

like image 850
sfsdfsdf sdfsdf Avatar asked Sep 27 '14 21:09

sfsdfsdf sdfsdf


People also ask

What is prefer Dist Laravel installation?

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

What does prefer Dist mean?

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

How install Laravel globally in Windows?

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.

How to install Laravel on Windows?

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?

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.

How to manage dependencies in Laravel?

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.

How to create a Laravel web application with composer?

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.


Video Answer


2 Answers

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

like image 135
sha-1 Avatar answered Oct 10 '22 05:10

sha-1


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.

like image 41
Marwelln Avatar answered Oct 10 '22 07:10

Marwelln