忽略php composer中的dev依赖项
我已经开发了一个基于作曲家laravel的项目,需要将其安装在远程生产服务器上.问题是我的权限/访问受限,所以我的选择是存档"包(使用composer archive
)并在生产中解压缩.
I have developed a composer laravel based project that I need to install on a remote production server. The problem is I have limited permission/ access so my option is to "archive" the package( using composer archive
) and unpack on the production.
我需要归档哪些文件夹,如何忽略软件包的dev依赖关系以及供应商的dev依赖关系?
What folders do I need to archive and how can I ignore the dev dependencies of the package as well as vendor dev dependencies?
composer archive
可能无济于事,因为此命令将创建软件包定义版本的存档.
composer archive
is likely not to help you, because this command creates an archive of a defined version of a package.
您可能希望上传整个工作应用程序,而不仅仅是一个软件包.您应该创建一个小脚本,该脚本将为您创建存档文件,该脚本应该执行以下操作:
You probably want to upload the whole working application, and not only one package. You should create a little script that will create the archive file for you, which should do:
- 从存储库中的新目录中签出应用程序
- 运行
composer install --no-dev
以安装所有必需的依赖,而没有开发依赖 - (可选)删除服务器上不需要的文件,例如文档,
.git
文件夹和其他内容 - 从所有这些文件创建存档文件
- (可选)将该存档上传到目标服务器,然后在其中取消存档
- 可以选择检查基本功能并切换到服务器上的新上载版本
- checkout the application from the repository in a new directory
- run
composer install --no-dev
to install all required dependencies without dev-dependencies - optionally delete files that are not necessary on the server, like documentation, the
.git
folder, and other stuff - create the archive file from all these files
- optionally upload that archive to the target server and unarchive there
- optionally check basic functions and switch to the new uploaded version on the server