的背景
我正在尝试使用Composer来管理 WordPress 插件的依赖项。我已经构建了几个 PHP 库(RESTian和Sidecar),我想将它们包含在我们正在构建的几个插件的子目录中,并且这些 PHP 库托管在 GitHub 上。WordPress 插件(当前)托管在私有 BitBucket 存储库中,因为它们是为客户端提供的,但是当我们准备发布它们时,这些插件也将发布到 WordPress 插件存储库中。
问题
我想要一个相对于插件根目录/libraries/restian/
的 目录结构。/libraries/sidecar/
对于那些了解 WordPress 的人来说,他们最终会像这样安装:
/wp-content/plugins/my-wp-plugin/libraries/restian/
/wp-content/plugins/my-wp-plugin/libraries/sidecar/
问题是我只能让 Composer 将它们放在一个/newclarity/
子目录中,该子目录比我想要添加到插件的目录结构('newclarity'
是我们的 GitHub 帐户)更复杂:
/wp-content/plugins/my-wp-plugin/libraries/newclarity/restian/
/wp-content/plugins/my-wp-plugin/libraries/newclarity/sidecar/
来源
这是composer.json
我用来研究和测试的文件:
{
"name":"mikeschinkel/my-wp-plugin",
"description":"My WordPress Plugin",
"type":"wordpress-plugin",
"config":{
"vendor-dir":"libraries/"
},
"require": {
"newclarity/restian":"dev-master",
"newclarity/sidecar":"dev-master"
},
"repositories":[
{
"type":"git",
"url":"https://github.com/newclarity/restian.git"
},
{
"type":"git",
"url":"https://github.com/newclarity/sidecar.git"
}
]
}
以下是 GitHub 上托管的库中的当前composer.json
文件:
{
"name": "newclarity/restian",
"description": "RESTian: A base class library to simplify building RESTful/Web API clients in PHP",
"require": {
"php": ">=5.2.4"
}
}
和:
{
"name": "newclarity/sidecar",
"description": "Sidecar: The Missing Plugin API for WordPress",
"require":{
"php":">=5.2.4"
}
}
我已经研究了4个多小时了。任何帮助,将不胜感激。
-麦克风