composer忽略了installer-paths配置

Pat*_*iel 8 php cakephp composer-php

我第一次尝试使用CakePHP与作曲家,但我有一些问题.

我有这个composer.json:

{
  "name": "example.com.br",
  "repositories": [
    {
      "type": "pear",
      "url": "http://pear.cakephp.org"
    }
  ],
  "config": {
    "vendor-dir": "Vendor/"
  },
  "require": {
    "php": ">=5.4",
    "pear-cakephp/cakephp": ">=2.4.3",
    "cakephp/debug_kit": "2.2.*",
    "smottt/wideimage": "dev-master"
  },
  "extra": {
    "installer-paths": {
      "app/Plugin/DebugKit": ["cakephp/debug_kit"],
      "app/Vendor/Wideimage": ["smottt/wideimage"]
    }
  }  
}
Run Code Online (Sandbox Code Playgroud)

当我跑步时composer install (or update) --prefer-dist,一切正常,除了smottt/wideimage.

此软件包正在安装在该/Vendor文件夹中/app/Vendor,因此,忽略installer-paths.

小智 15

当然,Danack所说的是真的:composer-installers插件只支持选择的包类型列表.

为此,我编写了一个composer-installers插件的扩展,它允许"installer-paths"指令处理任意包类型.

只需要oomphinc/composer-installers-extender在您的composer.json中添加并添加对任何其他任意包类型的支持:

"extra": {
  "installer-types": ["library"],
  "installer-paths": {
    "special/package/": ["my/package"],
    "path/to/libraries/{$name}/": ["type:library"]
  }
}
Run Code Online (Sandbox Code Playgroud)

对于未指定类型的包,请使用默认类型library.


Dan*_*ack 8

文档中.

您不能使用它来更改任何包的路径.这仅适用于需要编写器/安装程序并使用它处理的自定义类型的程序包.

从您正在安装的其中一个软件包:

{
    "name": "smottt/wideimage",
    "description": "An open-source PHP library for image manipulation. (With namespaces, PHP 5.3+)",
    "homepage": "http://wideimage.sourceforge.net",
    "type": "library",
    "license": ["GPL-2.0","LGPL-2.1"],
    "version": "11.02.19",
    "autoload": {
        "psr-0" : {
          "WideImage" : "lib/"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

因此,您尝试安装的软件包基本上不支持自定义安装路径.


Gil*_*ume 5

使用作曲家的选项“脚本”(仅适用于 linux):

"scripts": {
        "post-install-cmd": [
            "php -r \"system('mv '.getcwd().'/Vendor/smottt/wideimage '.getcwd().'/Vendor/Wideimage');\""
        ]
    }
Run Code Online (Sandbox Code Playgroud)