Composer Stability Flags

Composer has a cool feature, called stability flags. That allows you to specify the stability of a dependency.

minimum-stability

Assume there is no stable version of silex/silex. Then this entry

{
    "require": {
        "silex/silex": "1.0.*@dev"
    }
}

would install 1.0.x-dev, the dev version of the 1.0 branch.

I always interpreted “@dev” as “take the newest, even if it is unstable”. But currently I had this dependency in a composer.json:

"doctrine/migrations": "1.0.*@dev"

And Composer resolved that to “1.0.0-alpha3”. I do not really understand why. There is a stable version 1.0.0 and if “@dev” means “take the newest unstable version” then that would be 1.0.0-rc1.

If somebody can explain why “@dev” resolves to “1.0.0-alpha3” in this case please leave a comment here.

One thought on “Composer Stability Flags

  1. I posted this question into the composer-dev IRC group and got an answer from Jordi, one of the core committers of the composer project. Usually 1.0.*@dev picks up the newest version. In this special case it would be 1.0.0. But version 1.0.0 requires PHP 5.4 and in the root composer.json PHP 5.3 is required, that’s why version 1.0.0 is not picked up. Same is true for version 1.0.0-rc2. The newest version which is compatible with PHP 5.3 is 1.0.0-alpha3. Makes sense. Now I understand it 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s