通过Composer安装或复制供应商文件夹 [英] Install via Composer or copy vendor folder
问题描述
我想知道,在部署基于作曲家的项目时,为什么大多数人建议将SSH SSH到服务器中并安装作曲家并下载依赖项,如下所示:
I'm wondering, when deploying composer-based projects why most people advice to SSH into the server and install composer and download the dependancies as following:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer install
我看不到与在部署时仅复制/ vendor文件夹的区别。
我会错过任何东西吗?
I don't see the difference from just copying the /vendor folder when you deploy. Do I miss anything?
使用GIT
使用时GIT我可以想象/ vendor文件夹很大,应该避免。这是主要原因吗?
When using GIT I can imagine that the /vendor folder is large and should be avoided. Is this the main reason?
推荐答案
-
composer install
将安装dev依赖项,这不是您想要在服务器上安装的。因此,您在服务器上使用composer install --no-dev
。composer install
will install the dev dependencies, which is not something you want on your server. Because of that, you usecomposer install --no-dev
on your server.这将减少数量服务器上的文件数量。
This will reduce the amount of files on the server.
这篇关于通过Composer安装或复制供应商文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!