1

I have a project that has a dependency to 'webiny/crypt' package (I'm the owner of webiny/crypt repo also https://github.com/Webiny/Crypt).

{
        "require": {
                "webiny/crypt": "dev-master"
        },
        "minimum-stability": "dev"
}

Inside composer.json in webiny/crypt repo, I need to define a dependency to this repo: https://github.com/ircmaxell/php-cryptlib

That repo is not available on packagist, but inside its github repo it has a composer.json file.

I tried several solutions, but none of them worked. Here are some examples of what I tried...this is the content of composer.json of webiny/crypt.

Example 1:

"minimum-stability": "dev",
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/ircmaxell/PHP-CryptLib"
    }
],
"require": {
    "php": ">=5.4.0",
    "webiny/class-loader": "dev-master",
    "webiny/config": "dev-master",
    "webiny/std-lib": "dev-master",
    "ircmaxell/PHP-CryptLib": "*"
}

Example 2:

"minimum-stability": "dev",
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/ircmaxell/PHP-CryptLib"
    }
],
"require": {
    "php": ">=5.4.0",
    "webiny/class-loader": "dev-master",
    "webiny/config": "dev-master",
    "webiny/std-lib": "dev-master",
    "CryptLib/CryptLib": "*"
}

Also I tried both examples with 'dev-master' version instead of '*' on the CryptLib repo.

SlasherZ
  • 250
  • 3
  • 10
  • Your second example works for me - I just copied and pasted and added the missing `{` and `}` - it installs to `vendor/CryptLib/CryptLib` – madebydavid Sep 06 '14 at 19:35
  • I think the issue could be that the `minimum-stability` setting is applied from the root project only - so users who include `webiny/crypt` in their composer.json will also have to specify `"minimum-stability": "dev"` - your project cannot override the setting for the parent project. – madebydavid Sep 06 '14 at 19:39
  • There are three levels: project > webiny/cache > CryptLib ... the first two have minimum-stability set to "dev". The problem is that I cannot install the webiny/cache library from within my project, because the dependency to CryptLib cannot be resolved. – SlasherZ Sep 06 '14 at 19:42
  • You should use a stability flag instead - https://igor.io/2013/02/07/composer-stability-flags.html – madebydavid Sep 06 '14 at 19:43

1 Answers1

2

From the composer docs @ https://getcomposer.org/doc/05-repositories.md#repository

Repositories are only available to the root package and the repositories defined in your dependencies will not be loaded. Read the FAQ entry if you want to learn why.

I think your only option, unless you want to tell your users to add that repo too, is to fork https://github.com/ircmaxell/PHP-CryptLib and then publish it to packagist. Maybe drop the author an email regarding this first tho.

Sorry, probably not the answer you were looking for.

madebydavid
  • 6,457
  • 2
  • 21
  • 29