我尝试解决这个问题已经很长时间了,但仍然无法弄清楚我的错误在哪里。
我有两个存储库想要合并,一个是应用程序,另一个是框架核心。
// Application
- composer.json
- public/
- CCF/
- core/ <- here the core package should go
- vendor/ <- here it goes instead
现在,我想创建一个composer包,安装到
CCF/core/
而不是CCF/vendor/clancats/core/etc..
。所以我在以下位置创建了自定义安装程序:vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php
。
class ClanCatsFrameworkInstaller extends BaseInstaller
{
protected $locations = array(
'core' => 'CCF/core/',
'orbit' => 'CCF/orbit/{$name}/',
);
}
The composer.json of the core
{
"name": "clancats/core",
"description": "The ClanCatsFramework Core repository",
"type": "clancatsframework-core",
"license": "MIT",
"require": {
"php": ">=5.3",
"composer/installers": "~1.0"
}
}
composer.json of the application that should implement the core at CCF/core
{
"type": "project",
"require": {
"php": ">=5.3",
"clancats/core": "dev-master"
},
"config": {
"vendor-dir": "CCF/vendor"
},
}
But after all that composer still installs the core package at /vendor/clancats/etc..
So my question is what is my mistake that composer won't install the core package to CCF/core/?
- Added composer/installers to the requires.
- I created a custom installer which defines the path to the core
- Set the type of the core package to my custom one.
Another question that is spinning around my head, is my pattern wrong? I mean did i misunderstand how to use composer?
Github:
- framework install repo: https://github.com/ClanCats/Framework
- core repo: https://github.com/ClanCats/Core
Thanks for your help guys :)