Search by

roadrunner / goridge

roxblnfk

High-performance PHP-to-Go IPC bridge: the RPC transport between PHP workers and the RoadRunner application server

Package info

github.com/roadrunner-php/goridge

Homepage

Issues

Chat

Documentation

pkg:composer/roadrunner/goridge

Fund package maintenance!

roadrunner-server

Statistics

Installs: 197

Dependents: 0

Suggesters: 0

Stars: 122

4.5.0 2026-10-10 12:23 UTC

README

RoadRunner

High-performance PHP-to-Golang IPC bridge

Documentation Sponsor

Psalm Level Type Coverage Mutation testing badge


Goridge is a high-performance PHP-to-Golang codec library which works over native PHP sockets and the Golang net/rpc package. The library allows you to call Go service methods from PHP with minimal footprint, structures and []byte support. The Golang part lives in roadrunner-server/goridge; the library is the transport layer of RoadRunner, a high-performance PHP application server, load-balancer and process manager written in Golang.

Get Started

Installation

composer require roadrunner/goridge

PHP Latest Version on Packagist License Total Downloads

Calling a Go service

<?php

use Spiral\Goridge;
require "vendor/autoload.php";

$rpc = new Goridge\RPC\RPC(
    Goridge\Relay::create('tcp://127.0.0.1:6001')
);

//or, using factory:
$tcpRPC = Goridge\RPC\RPC::create('tcp://127.0.0.1:6001');
$unixRPC = Goridge\RPC\RPC::create('unix:///tmp/rpc.sock');
$streamRPC = Goridge\RPC\RPC::create('pipes://stdin:stdout');

echo $rpc->call("App.Hi", "Antony");

Factory applies the next format: <protocol>://<arg1>:<arg2>

More examples, including the Go server side, can be found in this directory.

Codecs

JSON is the default codec. Use withCodec() to switch to MsgpackCodec, ProtobufCodec or RawCodec from the Spiral\Goridge\RPC\Codec namespace.

Features

  • no external dependencies or services, drop-in (64bit PHP version required)
  • sockets over TCP or Unix (ext-sockets is required), standard pipes
  • very fast (300k calls per second on Ryzen 1700X over 20 threads)
  • native net/rpc integration, ability to connect to existing application(s)
  • standalone protocol usage
  • structured data transfer using JSON, MessagePack or Protobuf, and raw payloads
  • []byte transfer, including big payloads
  • asynchronous calls over a pool of relays with MultiRPC
  • service, message and transport level error handling
  • hackable
  • works on Windows
  • unix sockets powered (also on Windows)