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 composer diff --help # Display detailed usage instructions
-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
To help you control your dependencies, you may pass
--strict option when running in CI. If there are any changes detected, a non-zero exit code will be returned.
Exit code of the command is built using following bit flags:
1- General error.
2- There were changes in prod packages.
4- There were changes is dev packages.
8- There were downgrades in prod packages.
16- There were downgrades in dev packages.
You may check for individual flags or simply check if the status is greater or equal 8 if you don't want to downgrade any package.
While there are several existing packages offering similar functionality:
This package offers: