Composer:如何在 Symfony 2.3 中安装 `dev` 包? [英] Composer: how to install `dev` packages in Symfony 2.3?
问题描述
尝试在 Symfony 2.3 项目中安装 KnpGaufretteBundle ,我没有运气.问题是:
Trying to install the KnpGaufretteBundle in a Symfony 2.3 project, I'm having no luck. The problem is:
minimum-stability:stable
(在composer.json
中);- 我需要的包仍然是
dev-master
版本.
minimum-stability:stable
(incomposer.json
);- the bundle I require is
dev-master
version still.
在 Symfony 文档中阅读 this 是令人沮丧:
Reading this in the Symfony docs was frustrating:
如果你知道一个很酷的包或 PHP 库仍然需要开发人员最低稳定性,与首席开发人员交谈并说服他标记一个稳定的版本.
If you know of a cool bundle or PHP library that still requires a dev minimum stability, talk to the lead developer and convince him to tag a stable release.
我不会将整个项目的最低稳定性更改为dev
,因为它肯定会造成巨大混乱——我的意思是, 我不能同时使用稳定包和开发包吗?
I'm not changing the minimum stability of the whole project to dev
, as it would certainly make a huge mess - I mean, can't I use stable packages and dev packages side by side?
也许我错过了一些关于作曲家的东西吗?
Am I missing something about composer maybe?
编辑(2013 年 8 月 14 日)
根据下面 Sven 的回答,我编辑了我的 composer.json
(你可以在 here 找到它)并且它开始工作了.无论如何,这是一个部分解决方案,因为内联别名不适用于依赖项 - 所以在我的情况下,我必须首先指定不稳定"包的所有依赖项,然后一个一个地给它们起别名.
According to Sven's answer below, I've edited my composer.json
(you can find it here) and it started to work. Anyway, this is a partial solution, because inline aliases do not work for dependencies - so in my case I'd have to specify all dependencies of "less-than-stable" packages first, and alias them one by one.
推荐答案
随便用
"knplabs/knp-gaufrette-bundle": "dev-master@dev"
如果您需要最新的开发版本
if you need the latest dev version
您还可以将 minimum-stability 更改为 dev 并添加 "prefer-stable": true ,如下所示:
you can also change minimum-stability to dev and add "prefer-stable": true like this:
"minimum-stability": "dev",
"prefer-stable": true,
那么 composer 将总是试图找到一个稳定的版本,如果没有找到安装开发,所以你的 symfony 包仍然是稳定的.但在您的情况下,composer 将安装 v0.1.4(knplabs/knp-gaufrette-bundle 的最新稳定版),因此无论如何您都需要 dev-master@dev.prefer-stable 只是对您的提示.
then composer will always try to find a stable version and if nothing found install dev, so your symfony packages will be still stable. But in your case composer will install v0.1.4 (latest stable of knplabs/knp-gaufrette-bundle), so you need dev-master@dev anyway. prefer-stable is just a hint for you.
这篇关于Composer:如何在 Symfony 2.3 中安装 `dev` 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!