Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Roadrunner Laravel Package

spiral/roadrunner

High-performance PHP application server and process manager written in Go. RoadRunner replaces Nginx+FPM with long-running workers and a plugin system, offering HTTP(S)/2/3, FastCGI, PSR-7/17 support, and per-project extensibility.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

RoadRunner is a high-performance PHP application server that replaces traditional Nginx+FPM setups, offering lower latency, better resource utilization, and plugin-based extensibility. It aligns well with modern Laravel architectures by:

  • Replacing FPM: Eliminates the need for a separate PHP-FPM pool, reducing overhead.
  • PSR-7/PSR-15 Compliance: Integrates seamlessly with Laravel’s HTTP middleware stack (e.g., Illuminate\Http\Middleware).
  • Plugin Ecosystem: Supports HTTP/2/3, gRPC, queues (RabbitMQ, Kafka, SQS), OpenTelemetry, and workflow engines (Temporal), enabling microservices, event-driven, and observability-first architectures.
  • Stateless Workers: Enables horizontal scaling without shared memory bottlenecks (unlike FPM).

Key Laravel Synergies:

  • Lumen/HTTP APIs: RoadRunner’s HTTP server is a drop-in replacement for Laravel’s built-in server.
  • Queues: Native support for Laravel’s queue workers (via spiral/roadrunner-jobs plugin).
  • gRPC: Enables high-performance RPC for Laravel services (e.g., real-time APIs, microservices).
  • Observability: OpenTelemetry integration for distributed tracing (complements Laravel Scout, Horizon, etc.).

Integration Feasibility

Component Feasibility Notes
HTTP Server ✅ High Replaces php artisan serve or FPM; supports middleware, routing, and PSR-15.
Queue Workers ✅ High Plugins for RabbitMQ, Kafka, SQS, etc., replace Laravel’s queue:work.
gRPC ✅ Medium Requires protobuf extension; useful for internal services but not core Laravel features.
Temporal Workflows ⚠️ Low Overkill for most Laravel apps; niche use case for long-running workflows.
WebSockets ✅ Medium Via Centrifugo plugin; requires additional setup but enables real-time features.
Database Connections ⚠️ Low RoadRunner is stateless; Laravel’s connection pooling (e.g., pdo_mysql) must be managed externally.

Laravel-Specific Considerations:

  • Service Providers: RoadRunner workers are stateless; Laravel’s bind()/singleton() may need adjustments for shared state.
  • Middleware: PSR-15 middleware (e.g., App\Http\Middleware\Authenticate) works natively.
  • Events/Listeners: Requires explicit integration (e.g., via spiral/roadrunner-events plugin).
  • Artisan Commands: RoadRunner does not replace Artisan; CLI tasks must run separately.

Technical Risk

Risk Area Severity Mitigation
State Management High Laravel’s session/state (e.g., session:store) may break if not externalized (e.g., Redis).
Plugin Compatibility Medium Some plugins (e.g., Temporal) require deep Laravel architecture changes.
Performance Tuning Medium Go-based; requires tuning of worker pools, timeouts, and memory limits in .rr.yaml.
Debugging Complexity High Go/PHP hybrid stack; debugging requires familiarity with both ecosystems.
Migration Downtime Medium Zero-downtime migration possible but requires dual-run testing.
Vendor Lock-in Low MIT license; open-source; but Go-based plugins may introduce dependencies.

Critical Questions for TPM:

  1. Statefulness: How will Laravel’s session/cache (e.g., file, database) work in a stateless RoadRunner environment?
  2. Queue Workers: Will existing Laravel queue jobs (e.g., Illuminate\Queue\Jobs\Job) work out-of-the-box with RoadRunner’s plugins?
  3. Middleware Order: How will Laravel’s middleware groups (e.g., web, api) map to RoadRunner’s middleware stack?
  4. Artisan Integration: Can RoadRunner trigger Artisan commands (e.g., schedule:run) without blocking HTTP workers?
  5. Observability: How will Laravel’s logging (Monolog) integrate with RoadRunner’s OpenTelemetry metrics?
  6. Deployment: How will rolling updates work for RoadRunner workers (e.g., zero-downtime deploys)?
  7. Cost: Does RoadRunner’s Go overhead justify the performance gains over FPM for our workload?

Integration Approach

Stack Fit

RoadRunner is optimized for Laravel when paired with:

  • PHP 8.2+: Required for performance and compatibility (e.g., JIT, fiber support).
  • PSR-7/PSR-15: Laravel’s HTTP layer (e.g., nyholm/psr7, psr/http-message) is fully compatible.
  • Async PHP: Leverages spiral/roadrunner-http for non-blocking I/O (e.g., database calls).
  • Container Orchestration: Best suited for Kubernetes/Docker (native support for SIGUSR2 graceful restarts).
  • Observability Stack: Integrates with OpenTelemetry, Prometheus, and Jaeger for distributed tracing.

Anti-Patterns:

  • Monolithic Apps: RoadRunner shines in microservices or high-concurrency scenarios; not ideal for simple CRUD apps.
  • Shared Memory: Avoid in-memory caching (e.g., array cache) unless externalized (Redis).
  • Blocking I/O: Heavy synchronous operations (e.g., file_get_contents) will degrade performance.

Migration Path

Phase Steps Tools/Plugins
Proof of Concept Replace php artisan serve with RoadRunner for a single route (e.g., /api/health). spiral/roadrunner-cli, .rr.yaml
HTTP Server Migrate all HTTP routes to RoadRunner; test middleware, auth, and sessions. spiral/roadrunner-http, PSR-15
Queue Workers Replace queue:work with RoadRunner’s queue plugins (e.g., RabbitMQ). spiral/roadrunner-jobs
gRPC/Microservices Expose internal services via gRPC if needed. spiral/roadrunner-grpc
Observability Integrate OpenTelemetry for tracing; expose Prometheus metrics. spiral/roadrunner-otel
CI/CD Pipeline Add RoadRunner to Docker/Kubernetes manifests; test rollouts. Helm charts, Dockerfiles
Rollback Plan Maintain FPM as a fallback; use feature flags to toggle between stacks. N/A

Example .rr.yaml for Laravel:

version: '3'
server:
  command: "php artisan roadrunner:work"
http:
  address: "0.0.0.0:8080"
  middleware: ["static", "otel", "gzip"]
  pool:
    num_workers: auto
    max_jobs: 100
    allocate_timeout: 60s
    destroy_timeout: 60s
jobs:
  queue: "redis"
  pool:
    num_workers: 4
    max_jobs: 100
otel:
  service_name: "laravel-app"
  exporter: "otlp"
  otlp:
    endpoint: "http://jaeger:4317"

Compatibility

Laravel Feature RoadRunner Compatibility Workarounds
Routing ✅ Full Uses PSR-15 middleware; Laravel’s Route service works unchanged.
Middleware ✅ Full PSR-15 compliant; groups (web, api) map directly.
Authentication ✅ Full Laravel’s Auth middleware (e.g., Authenticate) works as-is.
Validation ✅ Full Uses Laravel’s Illuminate\Validation via PSR-15.
Database (Eloquent) ✅ Full Stateless; connections must be managed externally (e.g., connection pooling).
Queues ✅ Partial Requires spiral/roadrunner-jobs plugin; may need job class adjustments.
Events ⚠️ Partial No native support; requires
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony