php - Check if a dependency is installable (requirable) according to my composer.json
Get the solution ↓↓↓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
wheresomething
is a configuration that eventually will output
yes you can
I need, finally, to know if a requirement could be resolved or no.
Answer
Solution:
There is an obvious solution: Have your current files checked into version control (includingcomposer.json
andcomposer.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.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: can't write image data to path
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.