Q:

Requiring a fork with composer that other dependencies should use

I have a Laravel project that I would like to use my own fork (that has merged a couple of pull-requests). The following composer.json works as expected (it fetches 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 Illuminate components provided by Laravel (for example, zizaco/entrust which requires the same versions as provided by my fork) I end up with something like this:

Installing gexge/laravel-framework (4.0.x-dev 87556b2)
Reading .../Composer/cache/files/gexge/framework/87556b.....c382.zip from cache
Loading from cache
Extracting archive
REASON: zizaco/entrust dev-master requires illuminate/support 4.0.x -> satisfiable by 

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],
shrimpwagon/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],
illuminate/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].

Which actually ends up with both my fork and this fork installed, with the gexge fork taking precedence in the autoloader.
Is there a way of having dependencies pick up my fork rather than trying to find another? My fork has the same package name (composer.json hasn't been changed) - so I presumed this would work.
Alternatively, can I block certain packages from being selected? (I haven't found any docs for this.) Annoyingly, neither of the forks seem to have much reason to be on Packagist in the first place, but I guess Composer should be able to work around this.

A:

Your fork has a branch-alias for master set to 4.1.x-dev, so it doesn't match the 4.0.* requirement.
The solution is to alias the package, by 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"
}

And indeed those forks should not be on Packagist, I'll contact the owners.

