RoadRunner
  • 🟠General
    • What is RoadRunner?
    • Features
    • Quick Start
    • Installation
    • Configuration
    • Contributing
    • Upgrade and Compatibility
  • 👷PHP Worker
    • Worker
    • Workers pool
    • Developer mode
    • Code Coverage
    • Debugging
    • Environment
    • Manual workers scaling
    • Auto workers scaling
    • RPC
  • 🟢Customization
    • Building RR with a custom plugin
    • Integrating with Golang Apps
    • Writing a Middleware
    • Writing a Jobs Driver
    • Writing a Plugin
    • Events Bus
  • 🔌Plugins
    • Intro into Plugins
    • Centrifuge (WebSockets)
    • Service (Systemd)
    • Configuration
    • Server
    • Locks
    • gRPC
    • TCP
  • 🌐Community Plugins
    • Intro into Community Plugins
    • Circuit Breaker
    • SendRemoteFile
    • RFC 7234 Cache
  • 🔵App Server
    • Production Usage
    • RoadRunner with NGINX
    • RR as AWS Lambda
    • Docker Images
    • CLI Commands
    • Systemd
  • 🔐Key-Value
    • Intro into KV
    • Memcached
    • In-Memory
    • BoltDB
    • Redis
  • 📦Queues and Jobs
    • Intro into Jobs
    • Google Pub/Sub
    • Beanstalk
    • In-Memory
    • RabbitMQ
    • BoltDB
    • Kafka
    • NATS
    • SQS
  • 🕸️HTTP
    • Intro into HTTP
    • Headers and CORS
    • Proxy IP parser
    • Static files
    • X-Sendfile
    • Streaming
    • gzip
  • 📈Logging and Observability
    • OpenTelemetry
    • HealthChecks
    • Access Logs
    • AppLogger
    • Metrics
    • Grafana
    • Logger
  • 🔀Workflow Engine
    • Temporal.io
    • Worker
  • 🧩Integrations
    • Migration from RRv1 to RRv2
    • Spiral Framework
    • Yii
    • Symfony
    • Laravel
    • ChubbyPHP
  • 🧪Experimental Features
    • List of the Experimental Features
  • 🚨Error codes
    • CRC validation failed
    • Allocate Timeout
  • 📚Releases
    • v2025.1.2
    • v2025.1.1
    • v2025.1.0
    • v2024.3.5
    • v2024.3.4
    • v2024.3.3
    • v2024.3.2
    • v2024.3.1
    • v2024.3.0
Powered by GitBook
On this page
  • Update Configuration
  • No longer worry about echoing
  • Explicitly declare PSR-15 dependency
  • Update Worker Code
  • Update RPCs

Was this helpful?

Edit on GitHub
  1. Integrations

Migration from RRv1 to RRv2

PreviousWorkerNextSpiral Framework

Last updated 1 year ago

Was this helpful?

To migration integration from RoadRunner v1.* to v2.*/v2023+ follow the next steps.

Update Configuration

Second version of RoadRunner use single worker factory for all of its plugins. This means that you must include a new section into your config server which is responsible for the worker creation. Limit service no longer presented as separate entity but rather part of specific service configuration.

.rr.yaml
rpc:
  listen: tcp://127.0.0.1:6001

server:
  command: "php tests/psr-worker-bench.php"

http:
  address: "0.0.0.0:8080"
  pool:
    num_workers: 4

Read more in .

No longer worry about echoing

RoadRunner 2.0+ intercepts all output to the STDOUT, this means you can start using default var_dump and other echo function without breaking the communication. Yay!

Explicitly declare PSR-15 dependency

We no longer ship the default PSR implementation with RoadRunner, make sure to include one you like the most by yourself. For example:

$ composer require nyholm/psr7

Update Worker Code

RoadRunner simplifies worker creation, use static create() method to automatically configure your worker:

worker.php
<?php

use Spiral\RoadRunner;

include "vendor/autoload.php";

$worker = RoadRunner\Worker::create();

Pass the PSR-15 factories to your PSR Worker:

worker.php
<?php

use Spiral\RoadRunner;
use Nyholm\Psr7;

include "vendor/autoload.php";

$worker = RoadRunner\Worker::create();
$psrFactory = new Psr7\Factory\Psr17Factory();

$worker = new RoadRunner\Http\PSR7Worker($worker, $psrFactory, $psrFactory, $psrFactory);

RoadRunner 2 unifies all workers to use similar naming, change acceptRequest to waitRequest:

worker.php
<?php

while ($req = $worker->waitRequest()) {
    try {
        $rsp = new Psr7\Response();
        $rsp->getBody()->write('Hello world!');

        $worker->respond($rsp);
    } catch (\Throwable $e) {
        $worker->getWorker()->error((string)$e);
    }
}

Update RPCs

To create RPC client use new Goridge API:

worker.php
<?php

$rpc = \Spiral\Goridge\RPC\RPC::create('tcp://127.0.0.1:6001');
🧩
config reference