Compares composer.lock changes and generates Markdown report so you can use it in PR description.
Generates packages changes report in Markdown format by comparing
composer.lock files. Compares with last-commited changes by default.
composer global require ion-bazan/composer-diff
composer diff # Displays packages changed in current git tree compared with HEAD
-b) - path, URL or git ref to original
-t) - path, URL or git ref to modified
--no-dev- ignore dev dependencies (
--no-prod- ignore prod dependencies (
-p) - include platform dependencies (PHP, extensions, etc.)
-l) - include compare/release URLs
-f) - output format (mdtable, mdlist, json) - default:
--gitlab-domains- custom gitlab domains for compare/release URLs - default: use composer config
composer diff master # Compare current composer.lock with the one on master branch composer diff master:composer.lock develop:composer.lock -p # Compare master and develop branches, including platform dependencies composer diff --no-dev # ignore dev dependencies composer diff -p # include platform dependencies composer diff -f json # Output as JSON instead of table
While there are several existing packages offering similar functionality:
- jbzoo/composer-diff - requires PHP 7.2+, no composer plugin support
- josefglatz/composer-diff-plugin - works only right after install/update
- davidrjonas/composer-lock-diff - does not work as composer plugin
This package offers:
- Support for wide range of PHP versions, starting from 5.3.2 up to 8.0 and newer.
- No dependencies if you run it as composer plugin.
- Both standalone executable and composer plugin interface - you choose how you want to use it.
- Allows generating reports in several formats.
- Extra Gitlab domains support.
- 100% test coverage.
- MIT license.