The requested package exists but these are rejected by your constraint

use*_*519 3 php composer-php

I want to add this tag from the branch 1.x to my project.

I specified: "monolog/monolog": "dev-1.x#1.23.0"

And ran composer update monolog/monolog

Composer says:

Problem 1
    - The requested package monolog/monolog dev-1.x#1.23.0 exists as monolog/monolog[1.0.0, 1.0.0-RC1, 1.0.1, 1.0.2, 1.1.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.17.2, 1.18.0, 1.18.1, 1.18.2, 1.19.0, 1.2.0, 1.2.1, 1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.9.1, 1.x-dev, dev-master, 2.x-dev] but these are rejected by your constraint.
Run Code Online (Sandbox Code Playgroud)

I want to pull specific tag from specific branch. What do I do? this answer suggests I should be ok.

UPDATE:

After following Loek's advise and removing everything before the actual tag I get this: The requested package monolog/monolog (installed at 1.21.0, required as 1.23.0) is satisfiable by monolog/monolog[1.21.0] but these conflict with your requirements or minimum-stability.

I already have "minimum-stability": "dev" set up.

IMS*_*SoP 6

您可以使用composer why-not命令查看哪些包与您指定的版本冲突。

因此,无需对 composer.json 进行任何更改,运行:

composer why-not monolog/monolog 1.23.0
Run Code Online (Sandbox Code Playgroud)

这应该会告诉您发生冲突的位置。

您还可以采取一些措施来减少此类冲突的发生:

  • 对您的版本限制不那么严格。与包的特定版本挂钩使 Composer 无法更自由地找到一组工作包。
  • 编辑您的约束,然后composer update不带任何参数运行,让 Composer 找到满足这些约束的最佳包集,而不是强制它一次更改一个包。