简体   繁体   中英

Composer require a fork of a fork

My primary goal is to change a dependency version in the slack repo.
In my project, I need to use slack-laravel which is depended on slack .

What I did:

  • forked both slack and slack-laravel
  • changed the required dependency version in slack and pushed it to a branch called guzzle-patch
  • changed the original slack dependency in slack-laravel to my forked slack like so:

     "repositories": [ { "type": "vcs", "url": "https://github.com/gofilord/slack" } ], "require": { "php": ">=5.4.0", "maknz/slack": "dev-guzzle-patch" }, 
  • I then did a composer update and it worked with no problems.
  • finally, I pushed this update to a new guzzle-patch branch in my forked slack-laravel

The problem:
When I try to composer update in my project , pointing to my forked slack-laravel , it throws an error:

Problem 1
  - Installation request for maknz/slack-laravel dev-guzzle-patch -> satisfiable by maknz/slack-laravel[dev-guzzle-patch].
  - maknz/slack-laravel dev-guzzle-patch requires maknz/slack dev-guzzle-patch -> no matching package found.

My composer.json:

"repositories": [
  ...
  {
    "type": "vcs",
    "url": "https://github.com/gofilord/slack-laravel"
  }
],

"require": {
    ...
    "maknz/slack-laravel": "dev-guzzle-patch"
},

You cannot simply require dependencies with dev stability, you'd have to allow them in the root package.

Also, you should rethink depending on branches. This will hurt you in the long run because you will have a very hard time rolling back to a known working state - and with more than one package being used with a branch, you add more moving parts that all somehow rely on each other. It will be a mess, you have been warned. Note that tagging versions is probably the easiest way to do ever, and it will prevent things to go south that way.

Tagging versions will solve your problem.

Alternatively, "minimum-stability": "dev" would allow dev, alpha, beta or RC versions of ALL packages you require (probably not a very desirable thing), so additionally "prefer-stable":true should also be set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM