0

I'm trying to check out the doctrine/orm 2.6 branch on Composer, but for some reason this doesn't work:

$ composer require doctrine/orm:dev-2.6

[InvalidArgumentException]
Could not find package doctrine/orm in a version matching dev-2.6

Even though this is the approach suggested in Composer require branch name.

This works with the master branch (dev-master), but for some reason doesn't with the 2.6 branch. Why?

How to check out the 2.6 branch using Composer?

ChrisF
  • 134,786
  • 31
  • 255
  • 325
BenMorel
  • 34,448
  • 50
  • 182
  • 322
  • @emix You can download development branches to test them, not just releases. I've read the question you're linking to, and acted accordingly (I've always done it this way), yet it doesn't work. – BenMorel Nov 12 '19 at 13:39
  • @emix No need to post my composer.json, you can try it yourself: `mkdir test && cd test && composer require doctrine/orm:dev-2.6`. – BenMorel Nov 12 '19 at 13:47
  • 2
    Did you try `composer require doctrine/orm:2.6.x-dev`? – xabbuh Nov 12 '19 at 14:16

1 Answers1

7

When branch names look like versions, we have to clarify for composer that we're trying to check out a branch and not a tag. In the above example, we have two version branches: v1 and v2. To get Composer to check out one of these branches, you must specify a version constraint that looks like this: v1.x-dev. The .x is an arbitrary string that Composer requires to tell it that we're talking about the v1 branch and not a v1 tag (alternatively, you can name the branch v1.x instead of v1). In the case of a branch with a version-like name (v1, in this case), you append -dev as a suffix, rather than using dev- as a prefix.

Therefore, you have to do the following:

composer require doctrine/orm:2.6.x-dev

You can read more from the documentation here: https://getcomposer.org/doc/articles/versions.md#branches

Chin Leung
  • 14,621
  • 3
  • 34
  • 58