dptn69182 2012-08-09 12:23
浏览 658
已采纳

如何指定Composer安装路径?

I have this definition:

{
    "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.*"
    }
}

I am using Symfony 1, and I'd like to install them on plugins/sfGuardPlugin/. How do I specify this?

  • 写回答

3条回答 默认 最新

  • dongxi7704 2012-08-09 12:39
    关注

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

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

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

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

    So, your composer.json should look like this:

    {
        "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.*"
        }
    }
    

    Edit

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

    plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/

    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.*"
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)