PHP Composer¶
- ID
composer- Links
- Upstream stars
⭐ 29,536
- Last commit
2026-09-29
- Version requirement
>= 1.4
- Platforms
🅱️ BSD · 🐧 Linux · 🍎 macOS · ⨂ Unix · 🪟 Windows
- Operations
installed·outdated·search·install·upgrade·upgrade_all·remove·cleanup·doctor- purl types
pkg:composer/- CLI name
composer- Every call
composer global --no-ansi <command>- Issues and PRs
- Source
Dependency manager for PHP, driven in global mode.
Every operation is prefixed with global so it targets the user-wide
Composer project under COMPOSER_HOME ($XDG_CONFIG_HOME/composer on
XDG systems, ~/.composer on macOS and other Unixes,
%APPDATA%\Composer on Windows) rather than a working tree. installed and
outdated parse Composer’s --format=json output, while search reads
its plain-text listing; --no-ansi is forced on every call to strip color
codes.
What mpm adds to composer¶
Through mpm, composer gains --exact search, to narrow results to exact names.
Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover composer alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.
Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.
Your composer commands, in mpm¶
You already know composer: each operation maps one-to-one onto mpm, in an interface shared by every manager.
To… |
With |
With |
|---|---|---|
List what’s installed |
|
|
List outdated packages |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
Clear caches |
|
|
Run health checks |
|
|
Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.
Operations¶
Operation |
Supported |
Notes |
|---|---|---|
|
✅ |
|
|
✅ |
|
|
||
|
✅ |
Exact search backfilled by |
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
✅ |
|
|
||
|
✅ |
|
|
✅ |
Configuration¶
Ignore
composeron thempmCLI by passing the--no-composeroption.Ignore it for every run in your configuration:
[mpm] composer = false
Raise the timeout of all
composercalls:[mpm.overrides.composer] timeout = 900
Run
mpm config-template composerto print all overridable settings for your configuration file:[mpm.overrides.composer] cli_names = [ "composer", ] cli_search_path = [] dry_run = false ignore_auto_updates = true plan = false post_args = [] pre_args = [ "global", "--no-ansi", ] pre_cmds = [] requirement = ">=1.4.0" stop_on_error = false unmaintained = false version_cli_options = [ "--version", ] version_regexes = [ "Composer\\s+version\\s+(?P<version>\\S+)", ]
The arguments and environment variables listed in the box atop this page are forced on every composer call, so runs stay quiet, non-interactive and reproducible: the defaults you would set in CI anyway.
Recipes¶
A few jobs you would otherwise script around composer, one mpm command each:
Snapshot and clone a machine:
mpm --composer dump composer.toml, thenmpm restore composer.tomlon the next one.Export a compliance SBOM:
mpm --composer sbom(CycloneDX by default,--spdxfor SPDX).Gate CI on health:
mpm --composer doctorrelays PHP Composer’s own diagnosis and exits non-zero on trouble.
Privilege escalation¶
mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.
None of its operations is privileged.
See privilege escalation for the full policy.
Cooldown¶
State of PHP Composer’s release-age gating, from the cooldown support table:
Status: 🚧 Proposed
Mechanism: open PR adds
cooldownReference: composer/composer#12692
A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:
Registry: Packagist (
pkg:composer)Retraction: Index revert: versions are fetched “from tags you create in your VCS repository” (about), so deleting the upstream tag withdraws the version. The package-level
abandonedfield is flag only (API)Publish date: ✅ per-version
timeandpublished-time(metadata)
With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --cooldown best-effort opts back in.
Reference traces¶
A collection of raw native outputs captured from the manager’s own CLI and recorded in the manager source. If you know PHP Composer well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ composer global --no-ansi show --format=json
{
"installed": [
{
"name": "carbondate/carbon",
"version": "1.33.0",
"description": "A simple API extension for DateTime."
},
{
"name": "guzzlehttp/guzzle",
"version": "6.3.3",
"description": "Guzzle is a PHP HTTP client library"
},
{
"name": "guzzlehttp/promises",
"version": "v1.3.1",
"description": "Guzzle promises library"
},
{
"name": "guzzlehttp/psr7",
"version": "1.4.2",
"description": "PSR-7 message implementation"
}
]
}
$ composer global --no-ansi outdated --format=json
{
"installed": [
{
"name": "illuminate/contracts",
"version": "v5.7.2",
"latest": "v5.7.3",
"latest-status": "semver-safe-update",
"description": "The Illuminate Contracts package."
},
{
"name": "illuminate/support",
"version": "v5.7.2",
"latest": "v5.7.3",
"latest-status": "semver-safe-update",
"description": "The Illuminate Support package."
}
]
}
Version check¶
The version is probed by running:
$ composer --version
Composer version 2.1.8 2021-09-15 13:55:14
and extracted with:
r"Composer\s+version\s+(?P<version>\S+)"
Upstream project¶
Metrics |
|
|---|---|
Activity |
|
Popularity |
|
Metadata |
|
Changelog¶
8.0.0(2026-09-20)Correct the commands shown on each manager’s page, which named fewer options than
mpmactually runs.
6.4.0(2026-04-27)Add
removeoperation. Closes #1775.Fix
installoperation: usecomposer global requireinstead ofcomposer global install.
6.2.0(2026-03-25)Add
--no-ansioption to allcomposerinvocations.Fix search regex to strip whitespace-only descriptions.
2.8.0(2019-01-03)Add support for PHP
composer.