It is not possible to define a specific branch as a requirement with the composer

I am having problems using a specific branch as a dependency in my project.

I have one repository that I will name repositoryA, which is a project that I am worried about, and repositoryBwhich is another repository that I depend on repositoryA.

However, I have a specific branch in repositoryBnamed "1.0" that I want to specify for use by the composer.

What I tried in repositoryAis to specify the following as a requirement in composer.json (treat it as if each line were in different attempts, and not in the same file / attempt):

// ...
"my-vendor/repositoryB": "1.0-dev",
"my-vendor/repositoryB": "1.0.x-dev",
"my-vendor/repositoryB": "dev-1.0",
"my-vendor/repositoryB": "dev-1.0.x",
"my-vendor/repositoryB": "1.0",
"my-vendor/repositoryB": "1.0.x",
// ...

, , :

The requested package my-vendor/repositoryB 1.0.x-dev exists as  
my-vendor/repositoryB[dev-master] but these are rejected by your constraint.

, , , "1.0" - , , . json repositoryB :

//...
"extra": {
  "branch-alias": {
    "1.0-dev": "1.0.x-dev"
  }
}
//...

, ?

+4
3

:

, , composer.lock 1.0.x-dev , composer update.

+2

. -.

+1

If your branch has a name 1.0, then the restriction should work 1.0.x-dev(see also docs on branches ). If this does not work, you need to tell us what the error composer returns, because we cannot help you if you do not provide us with all the necessary information .

+1
source

Source: https://habr.com/ru/post/1662386/


All Articles