ergebnis/composer-normalize
Composer plugin that automatically normalizes composer.json formatting and ordering for consistent diffs and fewer review comments. Install as a dev dependency, allow the plugin, then run to enforce a standard structure across your project.
composer require --dev ergebnis/composer-normalizecomposer config allow-plugins.ergebnis/composer-normalize truecomposer normalize to normalize your composer.jsoncomposer normalize --dry-run to enforce consistencycomposer normalize before committing composer.json changes—ideally via pre-commit hook or in CI (e.g., GitHub Actions, GitLab CI)--dry-run in CI pipelines to fail builds if composer.json isn’t normalizedcomposer.json under extra.composer-normalize (e.g., {"indent-size": 2, "indent-style": "space"}) to ensure consistent formatting across team and toolingpre-commit or hirak/prestissimo for faster multi-project workflowscomposer.json at project root level (not globally in root of monorepo)composer.lock exists, composer normalize verifies it's up-to-date; use --no-check-lock only when deliberately working with stale lock filesextra.composer-normalize always overrides CLI options—don’t mix both approaches--dry-run --diff to confirm spacing behavior before committing; inconsistent --indent-size can cause unnecessary diffscomposer.json dev requirement); updates may change normalization rules (check changelog).git/hooks/pre-commit check:
if ! composer normalize --dry-run 2>&1 | grep -q "No changes"; then
echo "❌ composer.json not normalized. Run 'composer normalize'." >&2
exit 1
fi
normalize-check) to fail fast without blocking install steps--no-update-lock isn’t enabled and composer normalize has write permissionsHow can I help you explore Laravel packages today?