- How does RoadRunner compare to PHP-FPM+Nginx for Laravel API performance?
- RoadRunner typically offers lower latency and higher throughput than PHP-FPM+Nginx for Laravel APIs, especially under high concurrency. Benchmarks show it handles more requests per second with reduced memory overhead. However, performance depends on configuration—optimize `.rr.yaml` for worker pools, timeouts, and HTTP/2/3 settings. For Laravel, test with your specific middleware stack, as PSR-7 compliance ensures compatibility.
- Can RoadRunner replace Laravel’s built-in `php artisan serve` for local development?
- Yes, RoadRunner can replace `php artisan serve` for local development using its HTTP plugin. It supports HTTP/2/3, HTTPS, and FastCGI, making it a production-ready alternative even in dev. Configure it via `.rr.yaml` and use the `rr serve` command. Note that session handling (e.g., file-based) may require adjustments, as RoadRunner is stateless by design.
- Does RoadRunner support Laravel’s queue system (e.g., Redis, database queues)?
- RoadRunner integrates with Laravel’s queue system via plugins like `spiral/roadrunner-queue`, which supports Redis, database, and external brokers (RabbitMQ, Kafka, SQS). It handles job retries, middleware, and batch processing natively. For Laravel’s `ShouldQueue` jobs, ensure your queue driver is configured in `.rr.yaml` and that workers are properly scaled. Test with `queue:work` to verify compatibility.
- What Laravel versions does RoadRunner officially support?
- RoadRunner supports Laravel 8.x, 9.x, and 10.x, as it relies on PSR-7/PSR-17 compliance and Laravel’s middleware stack. Older versions (Laravel 7 or below) may require additional middleware adaptations. Always check the [RoadRunner documentation](https://roadrunner.dev) for the latest compatibility notes, as plugin updates may introduce breaking changes.
- How do I configure RoadRunner for HTTPS in Laravel?
- Configure HTTPS in RoadRunner by adding TLS settings to your `.rr.yaml` under the `http` plugin. Use `tls` with paths to your SSL certificate and key, or integrate with a reverse proxy (e.g., Nginx, Traefik) for termination. For Laravel, ensure your middleware (e.g., `TrustProxies`) accounts for the proxy setup. RoadRunner’s HTTP plugin supports SNI and modern cipher suites out of the box.
- Can RoadRunner handle WebSockets or gRPC for Laravel applications?
- Yes, RoadRunner supports WebSockets and gRPC via plugins (`websocket` and `grpc`). For Laravel, use the `grpc` plugin to expose internal services or integrate with third-party APIs. WebSockets require the `websocket` plugin and proper middleware configuration. Both plugins are PSR-7 compatible, so Laravel’s middleware stack (e.g., auth, CORS) will work as expected.
- What’s the rollback plan if RoadRunner causes issues in production?
- If RoadRunner introduces instability, you can roll back to PHP-FPM+Nginx by reverting your deployment configuration. Ensure your reverse proxy (e.g., Nginx) is pre-configured for FPM before switching. For Laravel, test the fallback by running `php artisan serve` or using a dedicated FPM pool. Monitor queue workers separately, as they may need manual intervention if using RoadRunner’s queue plugins.
- How does RoadRunner handle Laravel’s session storage (e.g., Redis, database)?
- RoadRunner itself is stateless, so session storage (Redis, database, etc.) must remain external. Configure Laravel’s session driver as usual in `.env` (e.g., `SESSION_DRIVER=redis`). RoadRunner’s HTTP plugin will forward session data transparently. For file-based sessions, ensure the storage directory is writable by the RoadRunner worker process, especially in containerized environments.
- Are there any Laravel-specific optimizations or tweaks for RoadRunner?
- Laravel benefits from RoadRunner’s OpCache and JIT support (if enabled in PHP). Optimize `.rr.yaml` for Laravel by adjusting worker memory limits, timeout settings, and enabling HTTP/2/3. Use the `otel` plugin for OpenTelemetry to trace Laravel’s middleware and queue jobs. For queues, scale workers based on job volume, and monitor performance with Prometheus metrics.
- What are the alternatives to RoadRunner for Laravel, and when should I choose them?
- Alternatives include PHP-FPM+Nginx (traditional but less performant), Swoole (high-performance but PHP-only), and Bref (AWS Lambda-focused). Choose RoadRunner if you need HTTP/2/3, gRPC, or plugin extensibility without vendor lock-in. Use Swoole for ultra-low latency in PHP-only environments, or stick with FPM if you prioritize simplicity and stability. RoadRunner’s Go-based architecture makes it ideal for microservices or high-throughput APIs.