localheinz/composer-normalize
Normalize your composer.json consistently. localheinz/composer-normalize sorts keys, formats lists, and enforces a stable structure to reduce diffs and keep projects tidy. Works well in CI and pre-commit hooks for repeatable results.
composer-normalize addresses composer.json standardization, which is critical for:
composer.json during CI/CD or collaborative workflows.^10.0 for Laravel core). The package’s sorting/normalization could help maintain consistency in composer.json across environments (local, staging, prod).composer.json files may diverge.composer global require localheinz/composer-normalize).composer install/update.- name: Normalize composer.json
run: composer normalize
composer.json formatting.composer-audit, composer-merge-plugin) might interact unpredictably.composer install.composer normalize --dry-run) to preview changes.extra.normalize.exclude).vendor/ reuse)?extra.laravel section be excluded or preserved in a specific order?composer.json fields)?composer.json.composer.json merges).composer global require localheinz/composer-normalize.composer normalize --dry-run
require, alphabetized config).- run: composer normalize
- run: composer install
.composer-normalize.json to customize rules (if needed).composer.json differs from normalized version:
composer normalize --check
husky or pre-commit).composer.json structure.post-install-cmd), ensure normalization runs before scripts that depend on composer.json parsing.composer.json files: Normalization may add missing sections (e.g., config, minimum-stability). Configure via .composer-normalize.json if undesired.composer normalize in VS Code/PHPStorm as a code action.composer.json.composer install (now with consistent composer.json).composer.json.composer install or explicitly..composer-normalize.json is optional.{
"sort-order": ["require", "require-dev", "config", "autoload"],
"exclude": ["extra.laravel"]
}
composer.json schema is stable. If Composer introduces breaking changes, the plugin will likely adapt quickly (open-source)..composer-normalize.json.composer normalize --dry-run --verbose.composer.json size: Negligible for Laravel projects (typically <100 lines).composer.json drift.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Normalization breaks CI pipeline | Blocked merges | Use --dry-run first; adjust rules. |
Custom composer.json ignored |
Inconsistent formatting | Explicitly include/exclude sections. |
| Plugin conflicts with other tools | Composer errors | Test with composer-audit, etc. |
| Outdated plugin version | Missing features/bugs | Pin version in .composer-normalize.json |
How can I help you explore Laravel packages today?