composer audit: check your PHP dependencies for security advisories
composer audit checks the packages in your project against published security advisories and tells you which installed versions are affected. It has been part of Composer since version 2.4, so you do not need to install anything.
Running it
composer audit
By default it checks the packages in your vendor folder. Useful options:
--locked: check composer.lock instead, without installing anything.--no-dev: leave out development packages, to see what runs in production.--format:table(the default),plain,jsonorsummary.--abandoned:ignore,reportorfailon packages whose maintainers have marked them abandoned.
The command exits with a non-zero code when it finds an advisory, so it works as a CI step as it is. Composer also runs a short audit after every composer update and composer require; --no-audit skips it.
Where the advisories come from
Composer asks each repository you use for advisories. For packages on Packagist.org, that is the Packagist security advisory API, which combines the PHP Security Advisories Database maintained by FriendsOfPHP with the GitHub Advisory Database. Packages from private repositories are only covered when that repository publishes advisories too.
Reading the result
Each advisory shows the package, a title, the CVE number when there is one, the affected version range, the date it was reported and a link to the full advisory. The severity is not always filled in: some sources do not publish one, so an empty severity does not mean the problem is minor. Read the advisory itself.
One weakness in a framework often produces several advisories at once, because the framework is split into many packages. A single update usually clears them all.
What to do about an advisory
- Find the fixed version. The advisory names the versions that are affected; the next release outside that range has the fix.
- If the fix fits your constraint, update that package:
composer update vendor/package, or with-Wwhen its dependencies have to move too. Runcomposer auditagain to confirm it is gone. - If the fix is only in a newer major version, you have a major upgrade to plan. Until then, read the advisory to see whether the vulnerable feature is one you use, and whether it gives a workaround.
- If there is no fix yet, follow the advisory's advice and watch for a release.
When you have decided an advisory does not apply to you, record that decision instead of switching the audit off. Composer accepts a list of ignored advisories with a reason in composer.json:
"config": {
"audit": {
"ignore": {
"CVE-2026-12345": "Feature not used, see issue 42"
}
}
}
Review that list when you update: an ignored advisory stays ignored until you remove it.
Development packages
--no-dev shows what reaches production, which is where most of the risk is. Development packages still run on developer machines and in CI, with access to your code and often to credentials, so update them too.
Check without the project at hand
composer audit needs Composer and the project. vgit gives the same advisories from the lock file alone, together with outdated packages and what a major upgrade changes, so you can see in one list what to fix first.