gpt4 book ai didi

php - 如何指定 Composer 安装路径?

转载 作者:IT老高 更新时间:2023-10-28 11:54:55 26 4
gpt4 key购买 nike

我有这个定义:

{
"repositories": [
{
"type": "package",
"package": {
"name": "symfony/sfGuardPlugin",
"version": "4.0.2",
"dist": {
"url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",
"type": "tar"
}
}
}
],
"require": {
"symfony/sfGuardPlugin": "4.0.*"
}
}

我正在使用 Symfony 1,我想将它们安装在 plugins/sfGuardPlugin/ 上。如何指定?

最佳答案

看来您可以将 vendor 目录定义为 something else (plugins 在你的情况下):

{
"config": {
"vendor-dir": "plugins"
}
}

然后,您可以将包名重命名为内部没有级别目录,例如:

        "package": {
"name": "sfGuardPlugin",

所以,你的 composer.json 应该是这样的:

{
"config": {
"vendor-dir": "plugins"
},
"repositories": [
{
"type": "package",
"package": {
"name": "sfGuardPlugin",
"version": "4.0.2",
"dist": {
"url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",
"type": "tar"
}
}
}
],
"require": {
"sfGuardPlugin": "4.0.*"
}
}

编辑

使用这个配置,你会得到路径(这当然对symfony不好):

plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/

我找到了一个使用这个 composer.json 的解决方法:

{
"config": {
"vendor-dir": "plugins"
},
"repositories": [
{
"type": "package",
"package": {
"name": "sfGuardPlugin",
"version": "4.0.2",
"source": {
"url": "http://svn.symfony-project.com/plugins/sfGuardPlugin/",
"type": "svn",
"reference": "branches/1.3/"
}
}
}
],
"require": {
"sfGuardPlugin": "4.0.*"
}
}

关于php - 如何指定 Composer 安装路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11883374/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com