check answers one question about one package and exits. It prints true or false and sets a matching exit code, which makes it the command to reach for inside a deployment script or a CI job.

bash
whatsdiff check laravel/framework
code
true
Options
With no flag, check reports any change at all. The flags narrow it to one kind of change:
| Option | Checks whether the package |
|---|---|
--has-any-change |
Changed in any way (the default) |
--is-updated |
Moved to a newer version |
--is-downgraded |
Moved to an older version |
--is-added |
Was added to the dependencies |
--is-removed |
Was removed from the dependencies |
bash
whatsdiff check laravel/framework --is-updated
whatsdiff check livewire/livewire --is-added
whatsdiff check deprecated/package --is-removed
Add --quiet to suppress the output and rely on the exit code alone.
Exit codes
| Code | Meaning |
|---|---|
0 |
The condition is true |
1 |
The condition is false |
2 |
Command error: not a git repository, invalid input, and so on |
Errors print a message instead of a boolean:
bash
$ whatsdiff check package --is-added
Error: Not in a git repository or git command failed
Restarting a service only when it changed
Skip the restart, and the downtime that comes with it, when the package was untouched:
bash
git pull origin main
composer install --no-dev --optimize-autoloader
if whatsdiff check laravel/pulse --is-updated --quiet; then
echo "Laravel Pulse was updated, restarting..."
php artisan pulse:restart
fi
Blocking a deploy that drops a security package
roave/security-advisories is a meta-package that refuses to install any version with a known vulnerability, so its removal is worth failing a build over:
yaml
name: Security Check
on: [pull_request, push]
jobs:
security-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # whatsdiff needs the full history
- name: Install whatsdiff
run: composer global require whatsdiff/whatsdiff
- name: Ensure security advisories package is present
run: |
if whatsdiff check roave/security-advisories --is-removed --quiet; then
echo "roave/security-advisories was removed. Blocking the deploy."
exit 1
fi
See analyse for the full picture, or between to compare two commits.