To install a new package and only that, you have two options:
-
Using the
requirecommand, just run:composer require new/packageComposer will guess the best version constraint to use, install the package, and add it to
composer.lock.You can also specify an explicit version constraint by running:
composer require new/package ~2.5
–OR–
-
Using the
updatecommand, add the new package manually tocomposer.json, then run:composer update new/package
If Composer complains, stating “Your requirements could not be resolved to an installable set of packages.”, you can resolve this by passing the flag --with-dependencies. This will whitelist all dependencies of the package you are trying to install/update (but none of your other dependencies).
Regarding the question asker’s issues with Laravel and mcrypt: check that it’s properly enabled in your CLI php.ini. If php -m doesn’t list mcrypt then it’s missing.
Important: Don’t forget to specify new/package when using composer update! Omitting that argument will cause all dependencies, as well as composer.lock, to be updated.