dereuromark/composer-prefer-lowest
Composer plugin to help you work with prefer-lowest setups by managing minimum dependency versions and related constraints. Useful for testing packages against lowest supported dependencies and keeping composer.json requirements consistent.
Add the package as a dev dependency to your reusable library or plugin:
composer require --dev dereuromark/composer-prefer-lowest
Then update your composer.json to include the script:
{
"scripts": {
"prefer-lowest": "ComposerPreferLowest\\Command\\PreferLowestCommand::run"
}
}
Run it locally to verify lowest-version compatibility:
composer prefer-lowest
This will generate a new composer.lock (temporarily) with lowest-compatible versions and run your tests (phpunit, etc.) against that install—without modifying your main composer.lock.
composer prefer-lowest as a separate job in your CI (e.g., GitHub Actions, GitLab CI), distinct from your main composer install && vendor/bin/phpunit run. Keep it fast: skip slow steps like linting, just install and test.composer.json to override the test command if you don’t use phpunit directly:
{
"extra": {
"prefer-lowest": {
"test-command": "vendor/bin/phpunit --test-suite lowest"
}
}
}
composer.json (with "minimum-stability": "dev" and "prefer-lowest": true) and leaves your main config untouched.composer.lock, ensure your CI cache or cache-clear logic doesn’t inadvertently persist the temporary lock. Consider disabling Composer cache for the prefer-lowest job.require constraints use realistic lower bounds (e.g., "php": "^7.4 || ^8.0" is safer than "php": "7.4.*"). The tool exposes constraints that are technically allowed but may be too loose.array_unshift(..., ...) behavior in newer PHP), but may also indicate missing composer require "monolog/monolog:^2.0" where ^1.0 would’ve sufficed. Always audit.prefer-lowest became a built-in flag in Composer 2.2). You might now prefer composer install --prefer-lowest + CI test—but this package adds automation, isolation, and configurability. Benchmark both approaches.How can I help you explore Laravel packages today?