mabe.berlin
mabe.berlin

Reputation: 1083

Composer: How to require one dependency OR another

My code works fine with PHP >= 5.3.0 but it also works fine with HHVM >= 3.0.0. How I can define that in composer.json?

The following means you have to run PHP and HHVM on the same process which is simply impossible:

"reqire": {
    "php": ">=5.3",
    "hhvm": ">=3.0"
}

Is it possible?

Upvotes: 1

Views: 87

Answers (1)

Alexandru Guzinschi
Alexandru Guzinschi

Reputation: 5726

From my point of view, your composer.json should require only PHP version because that is "at the core" of your library/project/whatever.

If you really want to point out that your code can run under hhvm, I guess you could create a separate "dummy" project mabe/hhvm-ready for example and add it under "suggest" in your main project with a comment This library can run under HHVM. or This library is HHVM ready..

Or you could print an informational message after your library has been installed from a script.

Upvotes: 1

Related Questions