0

Updating to Symfony 2.3 is easy if all the dependencies support it. One of the dependency I am using from Packagist says its requirement is Symfony <2.3. Therefore, I cannot install that library.

The library is a little old, and I know there is one or two problems, however, I wish I could still install it with composer.

How can I force composer to install the library dev-master even though packagist says <2.3 ?

4

1 回答 1

1

你可以在 github 上 fork 它,将 composer.json 更改为你的 bundle 设置:

"symfony/symfony":   "2.3.*",

并在您的项目 composer.json 中添加 fork 作为存储库:

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "youralias/highlight-bundle",
            "version": "dev-master",
            "source": {
                "url": "https://github.com/youralias/HighlightBundle",
                "type": "git",
                "reference": "origin/master"
            },
            "target-dir": "Highlight"
        }
    }

然后,当您需要时,这将使用您的叉子而不是原始叉子:nicodmf/highlight-bundle

至于 PSR-0

"autoload": {
    "psr-0": {
        "": "src/",
        "Highlight\\": "vendor/youralias/highlight-bundle"
    }
},

并要求:

"require": [
    ...,
    "youralias/highlight-bundle": "dev-master"
]

正如 cheesemacfly 所说“如果它适用于 Symfony 2.3”

于 2013-07-22T16:43:47.370 回答