I expected that
composer update videlalvaro/php-amqplib
would only update one dependency, but instead of that it updates all.
What am I missing?
PS: this dependency is defined as
"videlalvaro/php-amqplib": "2.2.0" in
PPS: the composer version used is
3da05c68f9561fa822c522b1815435ff990493ff 2013-10-02 14:25:06
PPPS: the actual output:
$ composer.phar update videlalvaro/php-amqplib --no-dev Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it. - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it. - Installation request for symfony/icu == 22.214.171.124 -> satisfiable by symfony/icu[v1.2.0].
composer update videlalvaro/php-amqplib does just update that dependency. However it doesn’t disable the other dependency checking that Composer does.
What the error message is complaining about is that the lib-icu is not available on your system. Apparently this would be solved by installing the PHP Intl extension.
You would see similar issues if you did a composer update on a project that required PHP 5.5 in one of it’s requires, downgraded to PHP 5.4 and then ran composer update on a separate require, that didn’t require PHP 5.5. Even though you wouldn’t be updating the require that needs PHP 5.5, the requirements for that package would not be resolvable, and so Composer would fail.
In your case, even though you’re just trying to update
videlalvaro/php-amqplib to the latest version, the requirements for
symfony/icu aren’t met, and so the composer update fails.
To try to be helpful, I’m guessing you re-installed PHP since you last did an update, and either removed or forgot to install the PHP Intl extension. Composer can’t satisfactorily satisfy the requirements your composer.json is setting, and so is defaulting to doing nothing, rather than knowingly doing an update where the requirements aren’t met.
So basically, you need to install the PHP extensions that are required for your existing installed software to run, and then Composer will be able to update the single package you want to update, as well as meet the requirements for the other packages.
You can list more than one dependency to update in one command:
composer update one/dependency second/dependency other/dependency
If you want to update only one dependency (
composer update some/dependency), you may face an issue that request is not satisfiable due to some other dependency is installed in wrong version. And that one does not necessarily must be listed in your
composer.json, it could be just dependency of some other dependency.
E.g. I wanted to update only and only
google/apiclient, but calling
composer update google/apiclient complained, that
google/auth (dependency of apiclient) requires
guzzlehttp/psr7 in version
1.2.3. I had
1.3.0 installed. The
guzzlehttp/psr7 was not listed in my
composer.json. What I had to do, was to call:
composer update guzzlehttp/psr7 google/apiclient
and that’s it! Just update the package you want, and if composer tells you, that you need to update (or downgrade :-)) some other package, list it in the command.