sensorario
sensorario

Reputation: 21600

Check if a dependency is installable (requirable) according to my composer.json

I've a problem, I just want to know if a certain package is installable inside my project that uses composer. But without run composer require. Is this possible?

For example, .. a sort og

composer require some/package --something

where something is a configuration that eventually will output

yes you can

I need, finally, to know if a requirement could be resolved or no.

Upvotes: 0

Views: 134

Answers (1)

Sven
Sven

Reputation: 70853

There is an obvious solution: Have your current files checked into version control (including composer.json and composer.lock) and then require the package you want to test.

The not so obvious solution:

composer prohibits some/package 1.2.3

You'd have to give the exact version you intend to install in order to make the command return meaningful output. Note that you will not really get an output if your package is installable.

See https://getcomposer.org/doc/03-cli.md#prohibits for some more details.

Upvotes: 1

Related Questions