- How do I check if my Laravel app’s RoadRunner version meets minimum requirements?
- Use the `VersionChecker` class with `greaterThan()` to validate against a version string, like `$checker->greaterThan('2.0.0')`. If RoadRunner is missing, it throws `RoadrunnerNotInstalledException`. Always wrap checks in a try-catch block for graceful handling.
- Can I integrate this into Laravel’s Artisan commands for pre-deployment checks?
- Yes. Create a custom Artisan command (e.g., `php artisan rr:check`) that instantiates `VersionChecker` and fails the build if the version is incompatible. This is ideal for CI/CD pipelines like GitHub Actions or GitLab CI.
- Does this package work with Laravel Forge or Envoyer for automated deployments?
- Absolutely. Add the package to your `composer.json` and include a version check in your Forge/Envoyer deploy script. If the check fails, the deployment halts, preventing mismatched RoadRunner versions from reaching production.
- What Laravel versions does this package support, and does it require any Laravel-specific dependencies?
- This package is Laravel-agnostic and works with any Laravel 8+ app using RoadRunner. It doesn’t require Laravel-specific dependencies—just RoadRunner itself. The package focuses solely on version validation, not Laravel features.
- How do I handle cases where RoadRunner isn’t installed but the package is required?
- The package throws a `RoadrunnerNotInstalledException` if RoadRunner isn’t detected. Catch this exception and either log a warning or fail the deployment. This helps catch misconfigurations early in CI/CD or local environments.
- Can I use this to enforce exact RoadRunner versions in production?
- Yes, use the `equal()` method to enforce exact versions, like `$checker->equal('2023.1')`. This is useful for production environments where specific RoadRunner features or bug fixes are required. Pair it with error handling to fail fast.
- Will this package work with RoadRunner’s HTTP or CLI API if the version endpoint changes?
- The package relies on RoadRunner’s version reporting capabilities. If RoadRunner’s API changes (e.g., version endpoint breaks), you may need to update the package or add fallback logic. Check the package’s GitHub for updates or contribute fixes if needed.
- Is there a performance impact of running version checks in every request?
- No. The package is lightweight (~100 LOC) and designed for one-time checks during deployment or startup. Avoid running it per-request; instead, use it in middleware during app initialization or as a pre-deploy hook.
- What’s the difference between this and manually running `rr get-version` in a shell script?
- This package provides a PHP-native solution with exception handling and Laravel-friendly integration (e.g., Artisan commands, middleware). Shell scripts require parsing CLI output, while this package offers structured version comparisons and better error handling.
- How do I test this package in my Laravel app’s CI pipeline?
- Add the package to your `composer.json` and include a test step in your CI (e.g., GitHub Actions) that runs `php artisan rr:check` or a custom script. Fail the pipeline if the version check throws an exception. Example: `if ! php artisan rr:check; then exit 1; fi`