Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer: How to install dependencies recursively automatically?

In using composer require to install packages / using composer install with composer.json, I run into the following problem:

"A" requires "B". After adding "B" and composer install again:

"B" requires "C". After adding "C" and composer install again:

"C" requires "D". After adding "D" and composer install again:


I am pretty sure I am missing something, or it would be the worst ever design when the dependency chain is long.

How do I make the composer automatically install all missing dependencies for installing "A" recursively, instead of loading for like 2-3 minutes each round only to tell me something is missing again, or there are better ways to install dependencies?

Update: Runs into the following error when using "update":

Installation request for illuminate/session 5.6.* -> satisfiable by illuminate/session[v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.2, v5.6.3, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9].

How do I install illuminate/session 5.6.* before I install illuminate/session 5.6.* so that I can be able to install illuminate/session 5.6.*? Am I missing a time machine?

like image 322
Alpha睪 Avatar asked Sep 12 '25 16:09

Alpha睪


1 Answers

If you want to update a package that also updates a dependency you have installed, you should probably pass the argument --with-dependencies

For example composer update vendor/package --with-dependencies

like image 199
eiriksm Avatar answered Sep 16 '25 08:09

eiriksm