- How do I install RoadRunner for a Laravel project?
- Install via Composer with `composer require spiral/roadrunner`. Then, download the Go binary for your OS from the [releases page](https://github.com/roadrunner-server/roadrunner/releases) and add it to your PATH. Configure RoadRunner using `.rr.yaml` in your project root, and ensure your Laravel `bootstrap/app.php` loads the PSR-7 adapter (e.g., `nyholm/psr7`).
- Does RoadRunner support Laravel’s HTTP middleware?
- Yes, RoadRunner fully supports Laravel’s HTTP middleware via PSR-15. Configure middleware in `.rr.yaml` under the `http` section, and it will integrate seamlessly with Laravel’s kernel. For example, CORS, gzip, and authentication middleware work out of the box.
- Can RoadRunner replace PHP-FPM in Laravel?
- Absolutely. RoadRunner is designed as a drop-in replacement for PHP-FPM, offering better performance (30-50% lower latency in benchmarks) and modern features like HTTP/2/3. Just configure RoadRunner to point to your Laravel `index.php` or `artisan serve` endpoint, and it will handle requests without changes to your Laravel codebase.
- How do I set up async queues with RoadRunner in Laravel?
- Use the `spiral/roadrunner-jobs` plugin to offload Laravel queues. Install it via Composer, then configure the `jobs` section in `.rr.yaml` to specify your queue driver (e.g., `redis`, `database`). RoadRunner will manage workers, replacing `php artisan queue:work`, with better scalability and observability.
- What Laravel versions does RoadRunner support?
- RoadRunner is compatible with Laravel 8.x, 9.x, and 10.x. It relies on PSR-7/PSR-15 standards, so as long as your Laravel version adheres to these standards (which all modern versions do), there are no version-specific limitations. Always check the [RoadRunner docs](https://roadrunner.dev) for the latest compatibility notes.
- How does RoadRunner handle WebSockets in Laravel?
- RoadRunner supports WebSockets via the `centrifugo` plugin (external dependency). Configure the `websockets` section in `.rr.yaml` to point to your Centrifugo instance, then use Laravel’s WebSocket packages (e.g., `beyondcode/laravel-websockets`) as usual. RoadRunner routes WebSocket connections to Centrifugo transparently.
- Is RoadRunner production-ready for Laravel?
- Yes, RoadRunner is actively used in production by Laravel applications. It includes features like process auto-restart, execution time limits, and systemd integration for stability. However, test thoroughly in staging, especially if migrating from FPM, as some edge cases (e.g., session handling) may require adjustments.
- Can I use RoadRunner with Docker or Kubernetes?
- RoadRunner works seamlessly in containerized environments. Include the Go binary in your Docker image or use the official `roadrunner/roadrunner` image. For Kubernetes, deploy RoadRunner as a sidecar or standalone service alongside your Laravel app. Example configs are available in the [RoadRunner docs](https://roadrunner.dev).
- How do I monitor RoadRunner’s performance in Laravel?
- RoadRunner integrates with Prometheus for metrics and OpenTelemetry (OTEL) for distributed tracing. Configure the `metrics` and `tracing` sections in `.rr.yaml` to expose endpoints. Use Laravel’s monitoring tools (e.g., Telescope) alongside RoadRunner’s metrics for a unified view. Exporters like Grafana can visualize the data.
- What are the alternatives to RoadRunner for Laravel?
- Alternatives include traditional Nginx+PHP-FPM, Swoole (PHP-based coroutine server), and Bref (serverless PHP). RoadRunner stands out for its Go-based performance, plugin ecosystem, and seamless Laravel integration via PSR standards. Swoole is PHP-native but lacks HTTP/2/3 and gRPC support out of the box, while FPM is simpler but less efficient.