How to update a single library with Composer?

Tool picture Tool · May 24, 2013 · Viewed 332.3k times · Source

I need to install only 1 package for my SF2 distribution (DoctrineFixtures).

When I run

php composer.phar update

I get

  - Updating twig/twig (dev-master 39d94fa => v1.13.0)
    The package has modified files:
    M CHANGELOG
    M doc/filters/batch.test
    M doc/filters/index.rst
    M doc/filters/url_encode.rst
    M doc/functions/index.rst
    M doc/tags/index.rst
    M doc/tests/index.rst
    M lib/Twig/Autoloader.php
    M lib/Twig/Compiler.php
    M lib/Twig/CompilerInterface.php
-10 more files modified, choose "v" to view the full list

It appears the last developer edited a lot of files inside vendor.

In order to get around this, I tried

php composer.phar update <package_name>

But that doesn't seem to work. How can I update/install only one library from composer.json?

Answer

Nicolai Fr&#246;hlich picture Nicolai Fröhlich · May 24, 2013

To install doctrine/doctrine-fixtures-bundle with version 2.1.* and minimum stability @dev use this:

composer.phar require doctrine/doctrine-fixtures-bundle:2.1.*@dev

then to update only this single package:

composer.phar update doctrine/doctrine-fixtures-bundle