php 安装 laravel --prefer-dist
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26079571/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
installing laravel --prefer-dist
提问by sfsdfsdf sdfsdf
I am following the Laravel installation on their website and I came across this line
我在他们的网站上关注 Laravel 安装,我遇到了这条线
composer create-project laravel/laravel --prefer-dist
composer create-project laravel/laravel --prefer-dist
Now, what exactly does the --prefer-dist
part mean? I can't see anything on their documentation.
现在,这--prefer-dist
部分到底是什么意思?我在他们的文档中看不到任何内容。
Thanks in advance.
提前致谢。
采纳答案by Marwelln
It's all available here: https://getcomposer.org/doc/03-cli.md#install
这一切都可以在这里找到: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.
--prefer-dist:与 --prefer-source 相反,如果可能,composer 将从 dist 安装。这可以显着加快在构建服务器和其他通常不运行供应商更新的用例上的安装。如果您没有正确的设置,这也是一种规避 git 问题的方法。
回答by sha-1
--prefer-dist
and --prefer-source
are the two options of composerwhich included in various documentations with a lack of proper explanation.
--prefer-dist
和--prefer-source
是作曲家的两个选项,它们包含在各种文档中,但缺乏适当的解释。
--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-dist
将尝试使用 GitHub 或其他可用 API 下载和解压缩依赖项的存档。在大多数情况下,这用于更快地下载依赖项。它不会下载依赖项的整个 VCS 历史记录,应该更好地缓存。此外,GitHub 上的档案可以排除一些您不需要的文件,只需将依赖项与 .gitattributes exclude 指令一起使用即可。
--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.
--prefer-source
将尝试在可用时克隆并保留依赖项的整个 VCS 存储库。当您希望在您的 vendor/ 文件夹中克隆原始 VCS 存储库时,这很有用。例如,您可能想要处理依赖项 - 修改它们、分叉它们、提交拉取请求等,同时还将它们用作首先需要它们的更大项目的一部分。
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:
简单地说,该--prefer-source
选项会更喜欢创建一个包目录,它是“版本控制存储库”,相当于您键入:
$ git clone ...
$ git clone ...
or
或者
$ svn checkout ...
$ 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:
另一方面,该--prefer-dist
选项将更喜欢创建一个非“版本控制存储库”,这相当于您键入:
$ git clone ... ; rm -fr dir/.git
$ git clone ... ; rm -fr dir/.git
or
或者
$ svn export ...
$ 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.
请记住,这些只是首选项,如果使用不提供 GitHub API 等存档的 VCS 存储库需要依赖项,则唯一可用的选项是克隆存储库。