sllh/composer-lint
Composer plugin that extends composer validate with extra linting rules for composer.json. Installs globally or per project, auto-enables on install, and can be configured via COMPOSER_HOME/config.json.
composer.json rules (e.g., PHP version constraints, package types, and version constraint formats), which directly reduces runtime errors and improves CI/CD reliability in Laravel projects.composer.json and CI/CD pipelines.COMPOSER_HOME/config.json, ensuring alignment with team-specific standards (e.g., enforcing ^ over ~ for version constraints).composer require sllh/composer-lint), and validation runs via composer validate—no Laravel-specific setup required.composer.json changes early in the development cycle.config/app.php PHP version matches composer.json requirements, reducing environment-related bugs.library, project types).composer.json schema).sort-packages) may conflict with Laravel’s composer.json conventions (e.g., grouped dependencies). Requires explicit configuration to avoid false positives.minimum-stability may flag legitimate use cases (e.g., dev dependencies). Custom configuration is critical to balance strictness and usability.composer-normalize, roave/security-advisories) that could replace specific rules?php, type, version-constraints, etc.) align with the team’s composer.json standards? Disable irrelevant ones to reduce noise and improve developer experience.--strict) or log warnings only? Define this in CI config to balance enforcement and developer productivity.php:^8.1) or custom package types? Test these scenarios to avoid unexpected failures.composer.json files (e.g., monorepos)? Benchmark in CI to ensure it doesn’t slow down the pipeline.composer.json errors early, reducing manual reviews and dependency-related bugs.composer.json files; test thoroughly.composer require --dev sllh/composer-lint
COMPOSER_HOME/config.json to enable only high-priority rules (e.g., php, version-constraints):
{
"config": {
"sllh-composer-lint": {
"php": true,
"version-constraints": true,
"type": false // Disable if not needed
}
}
}
composer validate to observe output and identify false positives/negatives.- name: Validate composer.json
run: composer validate --strict
--no-dev to avoid dev-dependency noise, then expand to include all rules.type → minimum-stability) based on team feedback.composer-normalize or roave/security-advisories.| Component | Compatibility Status | Notes |
|---|---|---|
| Laravel | ✅ Full compatibility | No Laravel-specific changes required. |
| Composer 1.x | ✅ Tested (up to 1.10) | Works as-is. |
| Composer 2.x | ⚠️ Partial (up to 2.4) | Last release lacks 2.5+ support; test or fork for newer versions. |
| PHP 8.x | ✅ Supported | Rules are parsed by Composer, not PHP. |
| Monorepos | ⚠️ Potential performance issues | Large composer.json files may slow validation; benchmark in CI. |
| Custom Package Types | ⚠️ May require configuration tweaks | Rule type might flag non-standard types; adjust config if needed. |
composer validate locally before committing changes to composer.json to catch issues early.composer validate --strict into the CI pipeline to block invalid changes from merging.COMPOSER_HOME/config.json rules to align with evolving team standards.COMPOSER_HOME/config.json file to enable/disable rules as needed. Document the configuration for onboarding new team members.minimum-stability for projects that intentionally use unstable dependencies.require.~2.0 instead of ^2.0).composer.json guidelines or wiki.minimum-stability flags a legitimate use case, disable it in the config for that project.How can I help you explore Laravel packages today?