cakephp composer包的自定义安装路径

yhived7q  于 10个月前  发布在  PHP
关注(0)|答案(4)|浏览(100)

你好,我正在尝试使用composer设置一个项目。我能够安装CakePHP,但我很难在自定义directy上安装cakephp/debug_kit。我试图将其安装在“vendor/cakephp/cakephp/app/Plugin/DebugKit/”上,因为CakePHP要求其插件安装在其“app”文件夹的Plugin目录下。
我已经根据this站点设置了我的composer.json,但插件仍然安装在“vendor/cakephp/debug_kit”上
这是我的composer.json,也许我的代码有问题。我只是一个使用composer.json的新手。

{
    "name" : "notmii/pse",
    "repositories" :
    [{
        "type": "package",
        "package":
        {
            "name" : "cakephp/cakephp",
            "version" : "2.3.5",
            "source" :
            {
                "type" : "git",
                "url" : "git://github.com/cakephp/cakephp.git",
                "reference" : "2.3.5"
            },
            "bin" : ["lib/Cake/Console/cake"]
        }
    },
    {
        "type": "package",
        "package":
        {
            "name" : "cakephp/debug_kit",
            "version" : "2.2.0",
            "source" :
            {
                "type" : "git",
                "url" : "https://github.com/cakephp/debug_kit.git",
                "reference" : "2.2.0"
            }
        }
    }],

    "extra":
    {
        "installer-paths":
        {
            "vendor/cakephp/cakephp/app/Plugin/DebugKit/": ["cakephp/debug_kit"]
        }
    },

    "require" :
    {
        "php": ">=5.3",
        "cakephp/cakephp" : ">=2.3.5",
        "cakephp/debug_kit": "2.2.*"
    }
}

字符串

f87krz0w

f87krz0w1#

将额外区块更改为:

"extra":
{
    "installer-paths":
    {
        "app/Plugin/DebugKit": ["cakephp/debug_kit"]
    }
},

字符串
这对我很有效。

khbbv19g

khbbv19g2#

如果你想将所有插件添加到app/Plugin,而不是为每个插件定义自定义路径,请像这样更新你的extra块:

"extra": {
    "installer-paths": {
        "app/Plugin/{$name}/": ["type:cakephp-plugin"]
    }
}

字符串

uklbhaso

uklbhaso3#

Composer Packages Custom Installer plugin,你不需要开发自定义安装程序。只要分叉它,并在src/Installer CPCInstaller下的config目录中添加您的说明,就可以为您做所有事情。

5lhxktic

5lhxktic4#

我建议使用oomphinc/composer-installers-extender项目。
关于这个项目的更多信息,你可以在GitHub项目页面上找到:https://github.com/oomphinc/composer-installers-extender
以下是我对Moodle的配置:

{
  "name": "evolic/e-learning",
  "license": "MIT",
  "type": "project",
  "description": "e-Learning application",
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/moodle/moodle.git"
    }
  ],
  "require": {
    "php": "^8.2",
    "ext-json": "*",
    "ext-zip": "*",
    "moodle/moodle": "v4.2.1",
    "composer/installers": "^2.2",
    "oomphinc/composer-installers-extender": "^2.0"
  },
  "scripts": {
    "auto-scripts": {
      "create symlinks": "scripts/create-symlinks.sh"
    },
    "post-install-cmd": [
      "@auto-scripts"
    ],
    "post-update-cmd": [
      "@auto-scripts"
    ]
  },
  "extra": {
    "installer-types": ["project"],
    "installer-paths": {
      "public/": ["moodle/moodle"]
    }
  },
  "config": {
    "allow-plugins": {
      "composer/installers": true,
      "oomphinc/composer-installers-extender": true
    }
  }
}

字符串

相关问题