Standalone Usage

You can use RoadRunner library as the component, without bringing the whole application into your project.

In order to create PHP worker pool on Golang:

srv := roadrunner.NewServer(
        Command: "php client.php echo pipes",
        Relay:   "pipes",
        Pool: &roadrunner.Config{
            NumWorkers:      int64(runtime.NumCPU()),
            AllocateTimeout: time.Second,
            DestroyTimeout:  time.Second,
defer srv.Stop()


res, err := srv.Exec(&roadrunner.Payload{Body: []byte("hello")})

Worker (echo) structure would look like:

 * @var Goridge\RelayInterface $relay
use Spiral\Goridge;
use Spiral\RoadRunner;

ini_set('display_errors', 'stderr');
require 'vendor/autoload.php';

$rr = new RoadRunner\Worker(new Spiral\Goridge\StreamRelay(STDIN, STDOUT));

while ($body = $rr->receive($context)) {
    try {
        $rr->send((string)$body, (string)$context);
    } catch (\Throwable $e) {

Make sure to run go get and composer require spiral/roadrunner to load necessary dependencies.

Edit this page