在“ composer install”上获取软件包的生产版本。 [英] Get production versions of packages on "composer install"

查看:106
本文介绍了在“ composer install”上获取软件包的生产版本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从创建作曲家以来,它使我们的生活变得更加轻松。但是,运行 composer install 通常最终会生成太多对开发有用的文件,但只会使生产服务器膨胀。共享主机的inode常常很有限,或者因为composer不在服务器上,所以您必须自己上载 vendor文件夹。

Since composer was created, it made our life a lot easier. However, running composer install often ends up with so many files that can be useful for development, but just bloat the production server. Shared hosting often has limited inodes, or you must upload the "vendor" folder yourself since composer isn't on the server.

当vendor文件夹中有6,000个文件时,这是这是一个问题,尤其是当您有多个项目,每个项目有6,000个文件时。这些文件中很多都是 README.MD或 TODO。生产服务器不需要开发人员的 TODO文件。

When the vendor folder has 6,000 files+ this is an issue, especially if you have multiple projects with 6,000 files each. And so many of these files are "README.MD" or "TODO". Production servers don't need the dev's "TODO" file.

我尝试在Google上进行搜索,但找不到任何线索,因此任何人都知道是否有作曲家

I tried searching on Google but I can't find any clues, so anyone knows if there is a composer command that will install a production version?

推荐答案

有一个功能请求,但该请求被拒绝了(几次)。现在,从Composer可以获得的最好的东西是:

There was a feature request for that, but it was rejected (several times). Right now the best what you can get from Composer is:

composer install --no-dev --prefer-dist

它将跳过安装开发包,而是使用dist档案,该档案通常不包含测试和其他不需要的文件在生产中运行软件包。

It will skip installation dev packages and prefer dist archives, which usually does not contain tests and other files not necessary to run package on production.

如果这还不够,您可以尝试使用 octolab / cleaner 插件。

If this is still not enough, you may try to use octolab/cleaner plugin.

这篇关于在“ composer install”上获取软件包的生产版本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆