2

So, I followed Saldeak's answer to this question. I want to use my own fork in a project of the repo, however, during installation I get conflicting requirements.

$ composer update zfcampus/zf-content-validation
Loading composer repositories with package information                                                                                                                                                         Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - zfcampus/zf-apigility-admin 1.6.0 requires zfcampus/zf-content-validation ^1.4 -> satisfiable by zfcampus/zf-content-validation[1.7.x-dev, 1.6.x-dev].
    - zfcampus/zf-apigility-admin 1.6.0 requires zfcampus/zf-content-validation ^1.4 -> satisfiable by zfcampus/zf-content-validation[1.7.x-dev, 1.6.x-dev].
    - zfcampus/zf-apigility-admin 1.6.0 requires zfcampus/zf-content-validation ^1.4 -> satisfiable by zfcampus/zf-content-validation[1.7.x-dev, 1.6.x-dev].
    - Can only install one of: zfcampus/zf-content-validation[1.7.x-dev, dev-alias-and-remove-empty-data].
    - Can only install one of: zfcampus/zf-content-validation[1.6.x-dev, dev-alias-and-remove-empty-data].
    - Can only install one of: zfcampus/zf-content-validation[1.7.x-dev, dev-alias-and-remove-empty-data].
    - Can only install one of: zfcampus/zf-content-validation[1.6.x-dev, dev-alias-and-remove-empty-data].
    - Installation request for zfcampus/zf-content-validation dev-alias-and-remove-empty-data -> satisfiable by zfcampus/zf-content-validation[dev-alias-and-remove-empty-data].
    - Installation request for zfcampus/zf-apigility-admin (locked at 1.6.0, required as ^1.5.9) -> satisfiable by zfcampus/zf-apigility-admin[1.6.0].

In the composer.json I require this:

"zfcampus/zf-content-validation": "dev-alias-and-remove-empty-data", 

And the repo has been added to the list:

{
  "type": "vcs",
  "url": "git@github.com:rkeet/zf-content-validation.git"
}

I've tried to

composer remove zfcampus/zf-content-validation
composer require zfcampus/zf-content-validation:dev-alias-and-remove-empty-data

And

composer remove zfcampus/zf-content-validation
composer update zfcampus/zf-content-validation

But every time this comes back to the above error.


Notes:

  • Cannot "just delete" all vendors and composer.lock to install latest of everything; there are more requirements than just this one that are tested for the installed versions
rkeet
  • 3,406
  • 2
  • 23
  • 49

1 Answers1

3

You need to alias your new branch as regular numeric branch, so it could be used to resolving requirements of other dependencies.

"zfcampus/zf-content-validation": "dev-alias-and-remove-empty-data as 1.7.x-dev", 

After this Composer will treat your branch as 1.7 line, so it should match ^1.4 constraint.

See Require inline alias section in documentation.

rob006
  • 21,383
  • 5
  • 53
  • 74
  • Life saver! Hadn't yet come across that particular feature! Thanks a lot! – rkeet Sep 24 '18 at 08:54
  • 1
    Quickly looked it up, could you add it to your answer? Direct link: https://getcomposer.org/doc/articles/aliases.md#require-inline-alias – rkeet Sep 24 '18 at 08:54