#12992·composer

Err when providing non-installed package name to `suggest`

Author: jnoordsijCreated Jul 21, 2026Updated Sep 15, 2026

Is your feature request related to a problem? Please describe.

The composer suggest command allows providing a package name to use as filter, e.g. composer suggest composer/composer will only show suggestions by the composer package. However, when one provides an expression of a non-installed package, the output of the command will be empty, which is not distinguishable from a response that the package does not have (fulfilled) suggests.

For example:

  • composer suggest composer/composer will often result in no output, given you are running
    • if ran on a repository not having composer/composer in its dependency tree
  • composer suggest composer/composr will always result in no output, not notifying the user of their typo
  • composer suggest composer/* will always result in no output, not notifying the user of the fact that this syntax is not supported for this command
  • composer suggest all will always result in no output, not notifying the user of the fact they probably intended to use composer suggest --all

Describe the solution you'd like

Whenever the package provided as filter is not found in the installed packages, err and exit with code non-zero:

> composer suggest composer/composr
composer/composr is not installed

Describe alternatives you've considered Alternatively, the output could be altered to "always" display results of some kind, e.g.

> composer suggest composer/composer
no suggestions found for composer/composer

This would improve for some of the cases above, but probably less so than an explicit error.

Additional context