roadrunner / version-checker
Checks that the installed RoadRunner binary matches the version required by the project's Composer packages
Fund package maintenance!
Requires
- php: ^8.2
- composer-runtime-api: ^2.0
- composer/semver: ^3.3
- symfony/process: ^5.4 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- mockery/mockery: ^1.6
- spiral/code-style: ^2.3.1
- testo/bridge-mockery: ^0.1.2
- testo/testo: ^0.10.55
- vimeo/psalm: ^6 || ^7
Suggests
None
Provides
None
Conflicts
None
Replaces
- roadrunner-php/version-checker: v1.4.0
This package is auto-updated.
Last update: 2026-10-10 13:07:37 UTC
README
Check the installed RoadRunner version from PHP
The package finds out which RoadRunner version is installed and checks it against a version constraint, so an application or a library can fail early with a clear message instead of running against an incompatible server. RoadRunner 2.x, 2023.x–2025.x and 3.x are supported.
Get Started
Installation
composer require roadrunner/version-checker
Usage
Use the RoadRunner\VersionChecker\VersionChecker methods to check the compatibility of the installed RoadRunner
version. The VersionChecker class has three public methods:
- greaterThan - Checks if the installed version of RoadRunner is greater than or equal to the specified version.
If no version is specified, the minimum required version will be determined based on the minimum required version of
the
spiral/roadrunnerpackage. - lessThan - Checks if the installed version of RoadRunner is less than or equal to the specified version.
- equal - Checks if the installed version of RoadRunner is equal to the specified version.
Versions are compared in RoadRunner release order: 2.x < 2023.x, 2024.x, 2025.x < 3.x.
For example, 3.0.0 satisfies greaterThan('2025.1'), and 2025.1.5 does not satisfy greaterThan('3.0').
All three methods throw an RoadRunner\VersionChecker\Exception\UnsupportedVersionException if the installed version
of RoadRunner does not meet the specified requirements. If RoadRunner is not installed, a
RoadRunner\VersionChecker\Exception\RoadrunnerNotInstalledException is thrown.
use RoadRunner\VersionChecker\VersionChecker; use RoadRunner\VersionChecker\Exception\UnsupportedVersionException; $checker = new VersionChecker(); try { $checker->greaterThan('3.0'); } catch (UnsupportedVersionException $exception) { var_dump($exception->getMessage()); // Installed RoadRunner version `2025.1.5` not supported. Requires version `3.0` or higher. var_dump($exception->getInstalledVersion()); // 2025.1.5 var_dump($exception->getRequestedVersion()); // 3.0 } try { $checker->lessThan('2024.3'); } catch (UnsupportedVersionException $exception) { var_dump($exception->getMessage()); // Installed RoadRunner version `2025.1.5` not supported. Requires version `2024.3` or lower. var_dump($exception->getInstalledVersion()); // 2025.1.5 var_dump($exception->getRequestedVersion()); // 2024.3 } try { $checker->equal('3.0'); } catch (UnsupportedVersionException $exception) { var_dump($exception->getMessage()); // Installed RoadRunner version `2025.1.5` not supported. Requires version `3.0`. var_dump($exception->getInstalledVersion()); // 2025.1.5 var_dump($exception->getRequestedVersion()); // 3.0 }
How the installed version is detected
When the RR_VERSION environment variable is set, its value is used as the installed version. Otherwise the
checker runs ./rr --version from the current working directory. The detected version is cached for the lifetime of
the process.
Path to the RoadRunner binary
To configure the VersionChecker to search for the RoadRunner binary in a location other than the default
(./rr), you can bind the RoadRunner\VersionChecker\Version\InstalledInterface
within application container using the RoadRunner\VersionChecker\Version\Installed class and passing the desired
file path as the $executablePath parameter. After that, you can retrieve the VersionChecker class from
application container.
Example with Spiral Framework container:
use RoadRunner\VersionChecker\Version\InstalledInterface; use RoadRunner\VersionChecker\Version\Installed; use RoadRunner\VersionChecker\VersionChecker; $container->bindSingleton(InstalledInterface::class, new Installed(executablePath: 'some/path')); $checker = $container->get(VersionChecker::class);
Without a container, pass the instance directly:
$checker = new VersionChecker(new Installed(executablePath: 'some/path'));
Testing
composer test
composer psalm
composer cs:diff