如何指定Composer安装路径? [英] How to specify Composer install path?

查看:1877
本文介绍了如何指定Composer安装路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个定义:

{
    "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 / 。如何指定这个?

推荐答案

似乎可以定义供应商 dir 其他插件您的情况):

It seems that you can define the vendor dir to be something else (plugins in your case):

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

名称中没有级别dir,例如:

Then, you might rename the package name to not have a level dir inside, like:

        "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):

Using this configuration, you will get the path (which is of course not good for symfony):


plugins / sfGuardPlugin / sfGuardPlugin-4.0.2 /

plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/

我发现这个 composer.json 有一个解决方法:

I found a workaround with this 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.*"
    }
}

这篇关于如何指定Composer安装路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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