如何在/ src目录中安装composer软件包? [英] How can I install a composer package into the /src dir?

查看:62
本文介绍了如何在/ src目录中安装composer软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何修改composer.json以直接安装到src-dir(Symfony / src)中?

How do I have do modify my composer.json to install directly into the src-dir (Symfony/src)?

{
"name": "acme/example-bundle",
"type": "symfony-bundle",
"license": "MIT",
"require": {
    "php": ">=5.3.2",
    "symfony/framework-bundle": "2.1.*"
},
"suggest": {
    "doctrine/doctrine-bundle": "*"
},
"autoload": {
    "psr-0": { "Acme": "src/" }
},
"target-dir": "../../src/Acme/ExampleBundle"

}

推荐答案

实际上,将供应商软件包安装到src目录不是一个好主意。因为不应编辑供应商软件包,并且src目录用于开发过程中编辑的代码。

actually it's not a good idea to install vendor packages to the src dir because vendor packages should not be edited and the src directory is meant for code that is edited in the development process.

我想到的一个原因是您想要执行修改这些软件包。如果这是关键,那么最好不要使用git子模块,因为composer仅具有单向流程,这意味着更改只能来自供应商软件包的来源,而源的上游则没有。

one reason that comes to my mind is that you want do modify these packages. if this is the point, you'd better be off using git submodules because composer only has a one way flow, meaning changes can only come from the source of the vendor package and there is no upstream to the source.

我在我的项目中将git子模块用于捆绑包,这些捆绑包不是特定于项目的,因此位于其自己的git存储库中,但在项目进行过程中得到了积极开发。

i use git submodules for the bundles in my projects that are not project specific and thus reside in their own git repository but are actively developed during in the project.

这篇关于如何在/ src目录中安装composer软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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