作曲家正在忽略安装程序路径配置安装程序、作曲家、路径

2023-09-06 16:38:41 作者:嘴甜心狠、才能站得稳°

我第一次尝试在 composer 中使用 CakePHP,但我遇到了一些问题.

I'm try using CakePHP for the first time with composer, but I have some problems.

我有这个 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"]
    }
  }  
}

当我运行 composer install (or update) --prefer-dist 时,除了 smottt/wideimage 之外,一切正常.

When I run composer install (or update) --prefer-dist, everything works except smottt/wideimage.

这个包被安装在 /Vendor 文件夹而不是 /app/Vendor,所以,installer-paths 被忽略了.

This package is being installed in the /Vendor folder instead /app/Vendor, so, installer-paths was ignored.

推荐答案

来自 文档.

您不能使用它来更改任何包的路径.这只是适用于需要 composer/installers 并使用它处理的自定义类型.

You cannot use this to change the path of any package. This is only applicable to packages that require composer/installers and use a custom type that it handles.

从您正在安装的 包 之一:p>

From one of the packages you're installing:

{
    "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/"
        }
    }
}

所以基本上你尝试安装的包不支持自定义安装路径.

So basically the package you're trying to install doesn't support custom install paths.