How to Install Only One Package with Composer

How to install only one package with Composer and the best way to install a whole set of vendors without dependencies errors.

You may want to install only one or two packages with composer to avoid resolving too many dependences and errors like

 Composer\DependencyResolver phar:///home/my_project/composer.phar/src/Composer/DependencyResolver/Solver.php:166

The first thing is to do a self update:

php composer.phar self-update

php -dmemory_limit=1024M composer.phar update codeplex/phpexcel

Installing two packages:

php -dmemory_limit=1024M composer.phar update symfony/monolog-bundle codeplex/phpexcel

Adding the option memrory limit will avoid some important out of memory errors

Installing a whole set of vendors or packages

If you have to update most of your packages or vendors, the best way to do it is:

- Validate that all vendors you want are listed in the composer.json file

- Make a backup of your vendors directory somewhere.

- Delete all the content in your vendor directory

Do a :

php composer.phar install

This way composer will install the best dependency version for every vendor in a clean space. Having to update existing vendor's directory may bring too many dependences conflicts to resolve.