A composer fork requirement that other dependencies should use

I have a Laravel project in which I would like to use my own fork (which combined a pair of pull request requests). The following .json composer works as expected (it extracts the master branch from my repo):

{ "repositories": [ { "type": "vcs", "url": "http://github.com/rmasters/framework" } ], "require": { "php": "5.4.*", "laravel/framework": "dev-master" }, ... "minimum-stability": "dev" } 

However, when I add a package that depends on the Illuminate components provided by Laravel (e.g. zizaco/entrust , which requires the same versions as my fork), I get something like this:

  • Install gexge / laravel-framework (4.0.x-dev 87556b2)
  • Reading ... / Composer / cache / files / gexge / framework / 87556b ..... c382.zip from cache
  • Download from cache
  • Extract Archive

  • REASON: zizaco / entrust dev-master requires highlighting / support 4.0.x -> doable

    • laravel / framework [v4.0.5, v4.0.4, v4.0.3, v4.0.2, v4.0.1, v4.0.0-BETA4, v4.0.0-BETA3, v4.0.0- BETA2, v4.0.0, 4.0.x- dev]
    • gexge / framework [4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4. 0.5],
    • crimpwagon / laravel-framework [4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BE TA3, v4.0.0-BETA4, v4.0.5],
    • backlight / support [4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4. 0.5].

In fact, this ends with both my fork and this fork, and the gexge fork has priority in the autoloader.

Is there any way that the dependencies depend on my plug and not try to find another? My fork has the same package name (the .json composer has not been changed) - so I assumed this would work.

Alternatively, is it possible to block certain packages from choosing? (I did not find any documents for this.) Annoyingly, none of the forks seem to have much reason to be in the Pakgastist in the first place, but I think Composer should be able to get around this.

+6
source share
1 answer

Your fork has an alias branch for the wizard installed on 4.1.x-dev , so it does not meet the requirement 4.0.* .

The solution is a package alias, requiring it like this

 { "repositories": [ { "type": "vcs", "url": "http://github.com/rmasters/framework" } ], "require": { "php": "5.4.*", "laravel/framework": "dev-master as 4.0.0" }, ... "minimum-stability": "dev" } 

Indeed, these forks should not be on Pakgasti, I will contact the owners.

+10
source

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


All Articles