Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using custom Git repository alongside Packagist in Composer

Tags:

composer-php

I want to try modifications I've made on the Doctrine ORM in my local project before submitting a pull request.

I have pushed my modifications on the default-lockmode branch in my GitHub repository clone, then added the following to composer.json:

{
    "require": {
        "doctrine/orm": "dev-default-lockmode"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/BenMorel/doctrine2.git"
        }
    ]
}

I thought this would favour the doctrine/orm package found in my Git repository over the one from Packagist, but still load the other packages from Packagist.

However, when I run composer update, I get the following error:

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for doctrine/orm dev-default-lockmode -> satisfiable by doctrine/orm[dev-default-lockmode].
  • doctrine/orm dev-default-lockmode requires doctrine/dbal >=2.5-dev,<2.6-dev -> no matching package found.

Potential causes:

  • A typo in the package name
  • The package is not available in a stable-enough version according to your minimum-stability setting

So it looks like it's expecting to find all packages in my GitHub repository now.

Is it possible to use a custom repository just for doctrine/orm, but still use Packagist for all the others?

like image 426
BenMorel Avatar asked Feb 10 '14 10:02

BenMorel


2 Answers

I was just missing the minimum-stability setting:

{
    "minimum-stability": "dev",

    "require": {
        "doctrine/orm": "dev-default-lockmode"
    },

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/BenMorel/doctrine2.git"
        }
    ]
}

Doctrine DBAL was correctly pulled from Packagist, this was not the problem. The real issue was that this package is not released as stable yet.

As often, the answer is in the error message, which I overlooked:

The package is not available in a stable-enough version according to your minimum-stability setting

like image 155
BenMorel Avatar answered Sep 27 '22 23:09

BenMorel


It looks like your issue is that the package you are including has itself got dependencies

"require": {
    "php": ">=5.3.2",
    "ext-pdo": "*",
    "doctrine/collections": "~1.1",
    "doctrine/dbal": ">=2.5-dev,<2.6-dev",
    "symfony/console": "2.*"
},

These are look like they are trying to be resolved from your repository.

Have you left the original references to doctrine repos in your config. They will be needed to resolve collections / dbal.

Your private repository should take priority.

Also to satisfy dependencies you should also look at aliases

https://getcomposer.org/doc/05-repositories.md#using-private-repositories

If you need further assistance can you post more of the composer file.

like image 36
BillyBigPotatoes Avatar answered Sep 27 '22 22:09

BillyBigPotatoes