嗨,我正在尝试使用composer设置一个项目。我能够安装CakePHP,但我很难在自定义目录上安装CakePHP/debug_kit。我试图将其安装在"vendor/cakephp/cakephp/app/Plugin/DebugKit/"上,因为cakephp要求其插件安装在其"app"文件夹的插件目录上。
我已经设置了我的作曲家。Json根据这个网站,但仍然插件得到安装在"vendor/cakephp/debug_kit"
这是我的作曲家。Json也许是我的代码有问题。我只是一个新手在使用composer.json。
<>之前{"name": "notmii/pse","存储库":[{"类型":"包","包":{name: cakephp/cakephp,版本号:2.3.5"源":{"type": "git"url: "git://github.com/cakephp/cakephp.git","reference": "2.3.5"},"bin": ["lib/Cake/Console/Cake "]}},{"类型":"包","包":{name: cakephp/debug_kit,version: 2.2.0;"源":{"type": "git"url: https://github.com/cakephp/debug_kit.git,"reference": "2.2.0"}}}),"额外的":{"installer-paths":{"供应商/cakephp/cakephp/应用程序/插件/DebugKit/":【"cakephp/debug_kit"】}},"要求":{"php":"> = 5.3","cakephp/cakephp": ">=2.3.5",2.2"cakephp/debug_kit":"。*"}}将额外的块改为:
"extra":
{
"installer-paths":
{
"app/Plugin/DebugKit": ["cakephp/debug_kit"]
}
},
如果您想将所有插件添加到app/Plugin
,而不是为每个插件定义自定义路径,请像这样更新您的extra
块:
"extra": {
"installer-paths": {
"app/Plugin/{$name}/": ["type:cakephp-plugin"]
}
}
Composer Packages Custom Installer插件,您不需要开发自定义安装程序。只需要FORK它,并在src/Installer下的config目录中添加您的说明,CPCInstaller将为您完成所有工作。
我推荐使用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
}
}
}