PHPackages                             spryker-sdk/composer-prefer-lowest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. spryker-sdk/composer-prefer-lowest

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spryker-sdk/composer-prefer-lowest
==================================

Checks prefer-lowest more strictly. Add-on for CI.

0.1.0(3y ago)0345MITPHPPHP &gt;=7.3

Since Oct 20Pushed 1y agoCompare

[ Source](https://github.com/spryker-sdk/composer-prefer-lowest)[ Packagist](https://packagist.org/packages/spryker-sdk/composer-prefer-lowest)[ RSS](/packages/spryker-sdk-composer-prefer-lowest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Composer Prefer Lowest Validator
================================

[](#composer-prefer-lowest-validator)

[![CI](https://github.com/spryker-sdk/composer-prefer-lowest/actions/workflows/ci.yml/badge.svg)](https://github.com/dereuromark/composer-prefer-lowest/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/09d3b38e78195f034d94c1794ab0edef935161d212712ee8aa37b9d05534ebac/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722d73646b2f636f6d706f7365722d7072656665722d6c6f776573742f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/composer-prefer-lowest)[![Minimum PHP Version](https://camo.githubusercontent.com/92fabb75236db7d7453db0680cfab230e4ba78cc321ad3864794f78327f3f3b0/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/a233577229d2ee5195a8a22e7ad26b8236db3535bfda753f65604c19e91ba7ae/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722d73646b2f636f6d706f7365722d7072656665722d6c6f776573742f6c6963656e73652e737667)](https://packagist.org/packages/dereuromark/composer-prefer-lowest)[![Coding Standards](https://camo.githubusercontent.com/dbabe22710e675cb88cd0b12196f1477e2376dea497332775692cf1359a75918/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d5053522d2d322d2d522d79656c6c6f772e737667)](https://github.com/php-fig-rectified/fig-rectified-standards)[![Total Downloads](https://camo.githubusercontent.com/6143adbdf349d05d746d0a90fdcfe90e2d69ae5c174abe4ec6fe8157be0e0324/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722d73646b2f636f6d706f7365722d7072656665722d6c6f776573742f642f746f74616c2e737667)](https://packagist.org/packages/dereuromark/composer-prefer-lowest)

This validator will strictly compare the specified minimum versions of your composer.json with the ones actually used by the `prefer-lowest` composer update command option.

This is useful for all libraries that want to make sure

- **the defined minimum of each dependency is actually still being tested**
- no silent regressions (like using too new methods of depending libraries) sneaked in

For details, see [Why and when is this useful?](https://www.dereuromark.de/2019/01/04/test-composer-dependencies-with-prefer-lowest). This has been built after Composer didn't have the [motivation](https://github.com/composer/composer/issues/7849) for it.

**A total must-have** for

- frameworks
- framework plugins/addons (and testing against the framework minors)
- custom libraries to be used by apps/projects which have at least one dependency to other libraries

It is somewhat important for the involved packages to follow semver here. Otherwise some of the comparison might be problematic.

This is not so useful for projects, as here there is no need to test against anything than latest versions already in use. Also, if your library has no dependencies, you can skip prefer-lowest checks as well as this validation.

Local Test-Run
--------------

[](#local-test-run)

You want to give it a quick test-spin for one of your libraries? See what results it yields?

```
composer update --prefer-lowest --prefer-dist --prefer-stable
composer require --dev --update-with-all-dependencies spryker-sdk/composer-prefer-lowest
vendor/bin/validate-prefer-lowest

```

If there is no output, that's good. `echo $?` should return `0` (success).

CI Installation
---------------

[](#ci-installation)

It is recommended to run only for CI and `composer update --prefer-lowest`. As such, it suffices to add it conditionally here.

E.g. for Travis CI:

```
php:
  - 7.4
  - 8.1

env:
  global:
    - DEFAULT=1

matrix:
  include:
    - php: 7.4
      env: PREFER_LOWEST=1

before_script:
  - if [[ $PREFER_LOWEST != 1 ]]; then composer install --prefer-source --no-interaction; fi
  - if [[ $PREFER_LOWEST == 1 ]]; then composer update --prefer-lowest --prefer-dist --prefer-stable --no-interaction; fi
  - if [[ $PREFER_LOWEST == 1 ]]; then composer require --dev spryker-sdk/composer-prefer-lowest; fi

script:
  - if [[ $DEFAULT == 1 ]]; then vendor/bin/phpunit; fi
  - if [[ $PREFER_LOWEST == 1 ]]; then vendor/bin/validate-prefer-lowest; fi

```

You can, of course, also directly include it into `require-dev`. After manually running `composer update --prefer-lowest` locally, you can also test this on your local computer then:

```
vendor/bin/validate-prefer-lowest

```

It returns the list of errors and exits with error code `1` if any violations are found. Otherwise it returns with success code `0`.

### Prefer stable

[](#prefer-stable)

Usually `composer update --prefer-lowest` suffices. Make sure you have `"prefer-stable": true` in your composer.json for this to work. Otherwise you might have to use the longer version as outlined above.

In general it is best to just use all flags for your CI script:

```
composer update --prefer-lowest --prefer-dist --prefer-stable --no-interaction

```

### Majors only

[](#majors-only)

If you want to only error the CI build for major constraint issues, use `--majors-only`/`-m` option:

```
vendor/bin/validate-prefer-lowest -m

```

The patch and minor issues will then be warnings only.

### Display only

[](#display-only)

If you want to just display the result in your CI report without failing the build, you could do:

```
vendor/bin/validate-prefer-lowest || true

```

### PHP version

[](#php-version)

In general: Use the minimum PHP version for `prefer-lowest` as defined in your composer.json.

This tool requires minimum **PHP 7.4**, as such make sure your library to test also runs on this (or higher) for the `prefer-lowest` CI job. At this point, with it being EOL already, you can and should not use any PHP version below 7.4 anyway, or provide support for it.

It is advised to also raise your composer.json entry for the min PHP version here. Use 7.4 or higher:

```
    "require": {
        "php": ">=7.4",

```

Local Composer Script Installation
----------------------------------

[](#local-composer-script-installation)

For local testing, when you do not want to modify your composer.json file, you can simple add this composer script:

```
"scripts": {
    ...
    "lowest": " validate-prefer-lowest",
    "lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev --update-with-all-dependencies spryker-sdk/composer-prefer-lowest && mv composer.backup composer.json",

```

Then run `composer lowest-setup` to set up the script and finally `composer lowest` to execute.

TODOs
-----

[](#todos)

- Better version handling, especially around special cases like suffixes.

Help is greatly appreciated.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1300d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10738957?v=4)[Spryker Bot](/maintainers/spryker-bot)[@spryker-bot](https://github.com/spryker-bot)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (61 commits)")[![DmytroKlymanSpryker](https://avatars.githubusercontent.com/u/111562890?v=4)](https://github.com/DmytroKlymanSpryker "DmytroKlymanSpryker (2 commits)")[![pavelmaksimov25](https://avatars.githubusercontent.com/u/82393959?v=4)](https://github.com/pavelmaksimov25 "pavelmaksimov25 (2 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![spryker-release-bot](https://avatars.githubusercontent.com/u/26904324?v=4)](https://github.com/spryker-release-bot "spryker-release-bot (1 commits)")

### Embed Badge

![Health badge](/badges/spryker-sdk-composer-prefer-lowest/health.svg)

```
[![Health](https://phpackages.com/badges/spryker-sdk-composer-prefer-lowest/health.svg)](https://phpackages.com/packages/spryker-sdk-composer-prefer-lowest)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
