Issue
Is there a way to composer require some/thing
without actually pulling the package? In my workflow, it would hasten things if I knew a command to just check version requirements and update composer.json without actually doing anything with regard to the vendor directory.
Solution
You can use --no-update
switch to avoid updating and installing new dependencies - it will only add new dependency to composer.json
.
composer require --no-update symfony/symfony
But since require
does not check if required package can be installed (it always pick the newest version compatible with your PHP as a constraint, without checking if it will be possible to install), this can leave composer.json
in non-installable state.
It will also not update composer.lock
so composer install
may ignore your new dependency. So this is probably a bad idea unless you want to do something with it before you commit new composer.json
.
You may try to use --dry-run
switch to test what will happen after composer update
- you will be able to check if composer.json
is installable, but composer.lock
still will be out of date.
composer update --dry-run
Answered By - rob006
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.