ergebnis/composer-normalize
Composer plugin to normalize composer.json automatically: consistent key ordering, formatting, and sorting of dependencies. Avoid manual formatting debates and keep projects tidy across teams and CI with a simple dev requirement and allow-plugins setting.
composer.json structure) rather than the application layer. This makes it agnostic to Laravel’s architecture but requires alignment with Composer’s workflow.composer.json across monorepos, multi-package projects, or CI/CD pipelines where standardized dependency declarations are critical.composer.json + extra.composer-normalize). No Laravel-specific hooks or service providers are required.husky or pre-commit) to enforce normalization before code reviews or merges.composer.json files may diverge in structure.composer.json is dynamically generated (e.g., by Laravel Mix or Forge).composer install if not cached or optimized.^2.0 → 2.0.0). The package claims to preserve semantics, but this should be validated empirically.autoload-dev vs. autoload conflicts in Laravel’s composer.json.replace or conflict sections (e.g., for Laravel’s illuminate/* packages).config.platform or config.preferred-install settings.composer.lock due to unsorted composer.json)?composer validate, php-cs-fixer for composer.json)?composer normalize --cache)?composer.json fails normalization.husky or pre-commit to enforce rules before commits.composer.json files exist.node_modules or vendor/).composer.json templates (e.g., in fresh installs).--dry-run to preview changes: composer normalize --dry-run.- name: Normalize composer.json
run: composer normalize
composer normalize before committing")..composer-normalize.json) to override defaults.composer.json structure is more standardized).post-install-cmd).composer.json (e.g., composer-patches, cweagans/composer-patches)..husky/pre-commit or pre-commit config to run before commits.composer install) to fail fast..composer-normalize.json.vendor/ (negligible for most projects).replace sections), performance in large repos.--verbose and check composer normalize --dry-run.composer.json).illuminate/* aliases).composer.json size. Test with 100+ packages to validate.composer normalize --cache) or parallelization (if supported in future).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Strict rules break CI/CD | Blocked merges | Use --dry-run first; adjust rules. |
Dynamic composer.json generation |
False positives (e.g., Laravel Mix) | Exclude paths or customize rules. |
| Composer plugin conflicts | composer install fails |
Test with all plugins in isolation. |
| Rule drift | Outdated rules cause issues | Pin to specific plugin version. |
| Large monorepo slowdown | CI/CD timeouts | Cache results; run in parallel. |
How can I help you explore Laravel packages today?