Git 如何在composer.json中覆盖单个包的供应商目录

Git 如何在composer.json中覆盖单个包的供应商目录,git,composer-php,typo3-flow,Git,Composer Php,Typo3 Flow,我正在通过composer捆绑一个web应用程序。在我的配置部分中,定义了框架(TYPO3流)所需的供应商目录: "config": { "vendor-dir": "Packages/Libraries", "bin-dir": "bin" }, 现在我有了一个定制包,它不是来自Packagist,而是来自Github。此包需要签出到Packages/Application/Vendor.PackageName。因此,我尝试使用目标目录: "repositories": [{

我正在通过composer捆绑一个web应用程序。在我的配置部分中,定义了框架(TYPO3流)所需的供应商目录:

"config": {
    "vendor-dir": "Packages/Libraries",
    "bin-dir": "bin"
},
现在我有了一个定制包,它不是来自Packagist,而是来自Github。此包需要签出到Packages/Application/Vendor.PackageName。因此,我尝试使用目标目录:

"repositories": [{
    "type": "package",
    "package": {
        "version": "dev-master",
        "name": "vendor/package",
        "source": {
            "url": "https://github.com/mycompany/mypackagerepo.git",
            "type": "git",
            "reference": "master"
        },
        "target-dir": "Packages/Application/Vendor.Package",
    }
}],
"require": {
    "typo3/flow": "2.0.*",
    "vendor/package": "dev-master"
}
从Github克隆工作正常,但现在包已签出到

Packages/Libraries/vendor/package/Packages/Application/Vendor.Package
这意味着供应商目录和目标目录是连接在一起的


如何能够完全覆盖单个软件包的供应商目录?感谢您的帮助。

您需要使用并将包类型更改为
typo3 flow package
,而不是
target dir
,这样您的包定义可以是:

"repositories": [{
    "type": "package",
    "package": {
        "version": "dev-master",
        "name": "vendor/package",
        "type": "typo3-flow-package",  
        "source": {
            "url": "https://github.com/mycompany/mypackagerepo.git",
            "type": "git",
            "reference": "master"
        },
        "require": {
            "composer/installers": "~1.0"
        }
    }
]}
默认情况下,您的软件包将安装在
Packages/Application/package
下,但如果您想在软件包文件夹前面加上供应商名称,并将其放在
Packages/Application/vendor.package
下,只需添加:

"extra": {
    "installer-paths": {
        "Packages/Application/{$vendor}.{$name}/": ["type:typo3-flow-package"]
    }
}