Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Composer Normalize

Composer Normalize Laravel Package

ergebnis/composer-normalize

Composer plugin that automatically normalizes composer.json: consistent key ordering, formatting, and whitespace to reduce diffs and style debates. Install as a dev dependency, allow the plugin, and run it in CI to keep composer.json tidy and predictable.

View on GitHub
Deep Wiki
Context7

Provides a composer plugin for normalizing composer.json.

Frequently asked questions about Composer Normalize
How do I install this package for Laravel projects?
Run `composer require --dev ergebnis/composer-normalize` in your Laravel project’s root. Then enable the plugin with `composer config allow-plugins.ergebnis/composer-normalize true`. No Laravel-specific setup is needed—it works globally with Composer.
Will this break existing Laravel applications?
No, this package only modifies the formatting of `composer.json` and `composer.lock` (if configured). It doesn’t alter Laravel’s core, autoloading, or runtime behavior. Always test with `--dry-run` first in CI.
Can I customize the normalization rules for my Laravel team?
Yes, define team-wide defaults in `composer.json` under `extra` (e.g., `indent-size: 4`, `indent-style: space`). Override these via CLI flags if needed. Example: `composer normalize --indent-size=2`.
Does this work with Laravel’s latest versions (e.g., Laravel 10)?
Absolutely. This package is Laravel-agnostic and compatible with all Laravel versions. It only interacts with Composer, which Laravel relies on for dependency management. Tested with Composer ≥2.0.
How should I integrate this into CI/CD for Laravel projects?
Start by running `composer normalize --dry-run` in CI to preview changes. Fail builds on unnormalized files with `composer normalize || exit 1`. For GitHub Actions, add it to your workflow like any other Composer command.
What if my team has mixed indentation (spaces/tabs) in composer.json?
The plugin enforces consistency based on your configured `indent-style` (default: spaces). Run `composer normalize --dry-run` to see changes before enforcing it. Document exceptions in your team’s contributing guidelines.
Are there performance concerns for large Laravel monorepos?
Normalization is lightweight and runs during `composer install` or manually. For monorepos, specify the `composer.json` file path (e.g., `composer normalize path/to/file.json`). Benchmark with `--dry-run` to measure impact.
Can I use this alongside Laravel’s `composer.lock`?
Yes, but avoid normalizing `composer.lock` unless necessary (use `--no-lock` flag). The tool focuses on `composer.json` to reduce diff noise. If `composer.lock` is stale, update it first (`composer update --lock`).
What if contributors resist strict formatting rules?
Start with `--dry-run` in CI to show changes without blocking. Use feature flags (e.g., `composer normalize --optional`) or make it optional via `composer.json` extras. Gradually enforce it as a team norm.
Are there alternatives for Laravel-specific composer.json formatting?
Most alternatives (e.g., `dealerdirect/phpcodesniffer-composer`) are PHP-CS-Fixer plugins and lack Composer-native integration. This package is purpose-built for Composer, offering deeper plugin hooks and CI/CD compatibility for Laravel projects.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony