RPC Integration

You can connect to RoadRunner server from your PHP workers using shared RPC bus. In order to do that you have to create and an instance of RPC class configured to work with the address specified in .rr file.


To connect to RoadRunner from PHP application in RPC mode you need:

  • ext-sockets
  • ext-json


To change the RPC port from the default (localhost:6001) use:

# rpc bus allows php application and external clients to talk to rr services.
  # enable rpc server
  enable: true

  # rpc connection DSN. Supported TCP and Unix sockets.
  listen: tcp://
$relay = new Spiral\Goridge\SocketRelay("", 6001);
$rpc = new Spiral\Goridge\RPC($relay);

You can immediately use this RPC to call embedded RPC services such as HTTP:

var_dump($rpc->call('http.Workers', true));

See RPC method definition here.

You can read how to create your own services and RPC methods in this section.

Edit this page