symfony – 如何在Bundle中正确声明对另一个Bundle的依赖?

前端之家收集整理的这篇文章主要介绍了symfony – 如何在Bundle中正确声明对另一个Bundle的依赖?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在Bundle中使用Bundle但不知何故它是failig.

"repositories": [
    {
        "type": "vcs","url": "https://github.com/myname/mybundle"
    }
],"require": {
    "PHP": ">=5.3.3","symfony/symfony": "2.1.*",(...)
    "myname/mybundle": "*"
},

这似乎到目前为止工作.但我无法弄清楚如何在“myname / mybundle”中声明另一个依赖项.

我在myname / mybundle的composer.json文件中尝试了以下内容,但没有一个工作:(

"repositories": [
    {
        "type": "vcs","url": "url": "https://github.com/drymek/PheanstalkBundle"
    }
],"require": {
    (...)
    "drymek/PheanstalkBundle": "dev-master"
}

"repositories": [
    {
        "type": "package","package": {
            "name": "drymek/PheanstalkBundle","version": "dev-master","source": {
                "url": "https://github.com/drymek/PheanstalkBundle.git","type": "git","reference": "master"
            }
        }
    }
],"require": {
    (...)
    "drymek/PheanstalkBundle": "dev-master"
}

当我朗读composer.phar更新我得到的全部是

– myname / mybundle dev-master需要drymek / pheanstalkbundle dev-master – >找不到匹配的包.

解决方法

好的,我找到了答案 here

它指出:存储库不会递归解析.您只能将它们添加到主composer.json中.依赖项’composer.jsons的存储库声明被忽略.

那太糟糕了……但现在至少我知道在哪里放置我的依赖(在根composer.json文件中)

猜你在找的设计模式相关文章