PHP Composer¶
- ID
composer- Home page
- 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 |
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
||
|
✓ |
|
|
✓ |
Selecting and configuring composer¶
Deselect composer for a single run with --no-composer, or persist the choice in your configuration:
[mpm]
composer = false
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.
Keep it enabled but tune how mpm drives it with a per-manager override:
[mpm.managers.composer]
timeout = 900
mpm config-template composer prints every overridable attribute as a ready-to-paste block.
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.
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); --allow-unsupported-managers opts back in.
Version probe¶
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+)"
Reference traces¶
Raw native outputs captured in the manager source: the reference mpm’s parsers were written against. If you know PHP Composer well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ composer global 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 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."
}
]
}
Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --composer installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.
Changelog¶
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.